Skip to content

Commit bd459ef

Browse files
committed
port tests from minitest over to rspec
1 parent 209cdec commit bd459ef

22 files changed

+726
-787
lines changed

.gitignore

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
.yardoc/
2-
.bundle/
3-
log/*.log
4-
pkg/
5-
TODO
1+
doc
62
*.gem
7-
.DS_Store
8-
.idea/
3+
*.iml
4+
.bundle
5+
Gemfile.lock
6+
pkg/*
7+
.rakeTasks
8+
.yardoc
9+
spike.rb
10+
html
11+
.idea
12+
.ruby-version

.rbenv-version

-1
This file was deleted.

Gemfile.lock

+42-8
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ GEM
2626
builder (3.0.4)
2727
coderay (1.0.9)
2828
daemons (1.1.9)
29+
diff-lcs (1.2.5)
2930
erubis (2.7.0)
3031
eventmachine (1.0.3)
3132
hike (1.2.3)
3233
i18n (0.6.1)
3334
journey (1.0.4)
35+
json (1.8.1)
3436
method_source (0.8.1)
3537
multi_json (1.7.7)
3638
pry (0.9.12.2)
@@ -40,13 +42,43 @@ GEM
4042
rack (1.4.5)
4143
rack-cache (1.2)
4244
rack (>= 0.4)
43-
rack-protection (1.5.0)
45+
rack-protection (1.5.3)
46+
rack
47+
rack-ssl (1.3.4)
4448
rack
4549
rack-test (0.6.2)
4650
rack (>= 1.0)
51+
railties (3.2.13)
52+
actionpack (= 3.2.13)
53+
activesupport (= 3.2.13)
54+
rack-ssl (~> 1.3.2)
55+
rake (>= 0.8.7)
56+
rdoc (~> 3.4)
57+
thor (>= 0.14.6, < 2.0)
4758
rake (10.1.0)
48-
rspec-mocks (2.13.1)
49-
sinatra (1.4.3)
59+
rdoc (3.12.2)
60+
json (~> 1.4)
61+
rspec (3.1.0)
62+
rspec-core (~> 3.1.0)
63+
rspec-expectations (~> 3.1.0)
64+
rspec-mocks (~> 3.1.0)
65+
rspec-core (3.1.4)
66+
rspec-support (~> 3.1.0)
67+
rspec-expectations (3.1.1)
68+
diff-lcs (>= 1.2.0, < 2.0)
69+
rspec-support (~> 3.1.0)
70+
rspec-mocks (3.1.1)
71+
rspec-support (~> 3.1.0)
72+
rspec-rails (3.1.0)
73+
actionpack (>= 3.0)
74+
activesupport (>= 3.0)
75+
railties (>= 3.0)
76+
rspec-core (~> 3.1.0)
77+
rspec-expectations (~> 3.1.0)
78+
rspec-mocks (~> 3.1.0)
79+
rspec-support (~> 3.1.0)
80+
rspec-support (3.1.0)
81+
sinatra (1.4.5)
5082
rack (~> 1.4)
5183
rack-protection (~> 1.4)
5284
tilt (~> 1.3, >= 1.3.4)
@@ -56,10 +88,11 @@ GEM
5688
multi_json (~> 1.0)
5789
rack (~> 1.0)
5890
tilt (~> 1.1, != 1.3.0)
59-
thin (1.4.1)
91+
thin (1.6.2)
6092
daemons (>= 1.0.9)
61-
eventmachine (>= 0.12.6)
93+
eventmachine (>= 1.0.0)
6294
rack (>= 1.0.0)
95+
thor (0.19.1)
6396
tilt (1.4.1)
6497
tzinfo (1.0.0)
6598

@@ -71,7 +104,8 @@ DEPENDENCIES
71104
intercom-rails!
72105
pry
73106
rake
74-
rspec-mocks (~> 2.12)
75-
sinatra (~> 1.4.3)
76-
thin (~> 1.4.1)
107+
rspec (~> 3.1)
108+
rspec-rails (~> 3.1)
109+
sinatra (~> 1.4.5)
110+
thin (~> 1.6.2)
77111
tzinfo

Rakefile

+3-11
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ end
88

99
Bundler::GemHelper.install_tasks
1010

11-
require 'rake/testtask'
11+
require 'rspec/core/rake_task'
12+
RSpec::Core::RakeTask.new(:spec)
1213

13-
Rake::TestTask.new("test") do |test|
14-
test.libs << 'lib'
15-
test.libs << 'test'
16-
17-
test.test_files = FileList['test/**/*_test.rb']
18-
test.warning = false
19-
test.verbose = true
20-
end
21-
22-
task :default => :test
14+
task :default => :spec

intercom-rails.gemspec

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ Gem::Specification.new do |s|
2020
s.add_dependency 'activesupport', '>3.0'
2121
s.add_development_dependency 'rake'
2222
s.add_development_dependency 'actionpack', '>3.2.12'
23-
s.add_development_dependency 'rspec-mocks', '~> 2.12'
23+
s.add_development_dependency 'rspec', '~> 3.1'
24+
s.add_development_dependency 'rspec-rails', '~> 3.1'
2425
s.add_development_dependency 'pry'
25-
s.add_development_dependency 'sinatra', '~> 1.4.3'
26-
s.add_development_dependency 'thin', '~> 1.4.1'
26+
s.add_development_dependency 'sinatra', '~> 1.4.5'
27+
s.add_development_dependency 'thin', '~> 1.6.2'
2728
s.add_development_dependency 'tzinfo'
2829
end
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
1-
require 'test_setup'
1+
require 'spec_helper'
22

33
require 'action_controller'
4-
require 'action_controller/test_case'
4+
5+
require "rails/all"
6+
require 'rspec/rails'
7+
8+
module Rails
9+
def self.env
10+
ActiveSupport::StringInquirer.new("production")
11+
end
12+
end
513

614
TestRoutes = ActionDispatch::Routing::RouteSet.new
715
TestRoutes.draw do
816
get ':controller(/:action)'
917
end
1018

11-
class ActionController::Base
19+
module IntercomRails
20+
class Application < Rails::Application
21+
def routes
22+
TestRoutes
23+
end
24+
end
25+
end
1226

27+
class ActionController::Base
1328
include IntercomRails::CustomDataHelper
1429
include IntercomRails::AutoInclude::Method
1530
after_filter :intercom_rails_auto_include
1631

1732
include TestRoutes.url_helpers
1833
include TestRoutes.mounted_helpers
19-
2034
end
2135

22-
class ActionController::TestCase
23-
24-
def setup
25-
super
26-
@routes = TestRoutes
36+
RSpec.configure do |config|
37+
config.before(:each) do
38+
IntercomRails.config.app_id = "abc123"
2739
end
28-
29-
end
40+
end

0 commit comments

Comments
 (0)