rspec-rails 3.0.0.beta1 → 3.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data.tar.gz.sig +0 -0
  2. data/Changelog.md +46 -0
  3. data/README.md +19 -17
  4. data/features/Generators.md +1 -0
  5. data/features/README.md +7 -15
  6. data/features/controller_specs/anonymous_controller.feature +222 -164
  7. data/lib/generators/rspec/feature/feature_generator.rb +15 -0
  8. data/lib/generators/rspec/feature/templates/feature_spec.rb +5 -0
  9. data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +0 -6
  10. data/lib/generators/rspec/integration/integration_generator.rb +0 -11
  11. data/lib/generators/rspec/integration/templates/request_spec.rb +0 -5
  12. data/lib/generators/rspec/model/templates/fixtures.yml +1 -1
  13. data/lib/generators/rspec/scaffold/scaffold_generator.rb +0 -8
  14. data/lib/generators/rspec/scaffold/templates/controller_spec.rb +4 -4
  15. data/lib/generators/rspec/scaffold/templates/edit_spec.rb +0 -9
  16. data/lib/generators/rspec/scaffold/templates/index_spec.rb +0 -7
  17. data/lib/generators/rspec/scaffold/templates/new_spec.rb +0 -9
  18. data/lib/generators/rspec/scaffold/templates/show_spec.rb +0 -7
  19. data/lib/rspec/rails.rb +1 -1
  20. data/lib/rspec/rails/adapters.rb +18 -15
  21. data/lib/rspec/rails/example/controller_example_group.rb +18 -9
  22. data/lib/rspec/rails/example/view_example_group.rb +3 -0
  23. data/lib/rspec/rails/matchers/be_a_new.rb +1 -1
  24. data/lib/rspec/rails/matchers/be_new_record.rb +2 -2
  25. data/lib/rspec/rails/matchers/be_valid.rb +10 -3
  26. data/lib/rspec/rails/matchers/have_rendered.rb +2 -2
  27. data/lib/rspec/rails/matchers/redirect_to.rb +2 -2
  28. data/lib/rspec/rails/matchers/relation_match_array.rb +1 -1
  29. data/lib/rspec/rails/matchers/routing_matchers.rb +7 -3
  30. data/lib/rspec/rails/mocks.rb +50 -26
  31. data/lib/rspec/rails/vendor/capybara.rb +4 -4
  32. data/lib/rspec/rails/version.rb +1 -1
  33. data/spec/generators/rspec/controller/controller_generator_spec.rb +16 -16
  34. data/spec/generators/rspec/feature/feature_generator_spec.rb +43 -0
  35. data/spec/generators/rspec/helper/helper_generator_spec.rb +4 -4
  36. data/spec/generators/rspec/install/install_generator_spec.rb +4 -4
  37. data/spec/generators/rspec/integration/integration_generator_spec.rb +8 -20
  38. data/spec/generators/rspec/mailer/mailer_generator_spec.rb +11 -11
  39. data/spec/generators/rspec/model/model_generator_spec.rb +7 -7
  40. data/spec/generators/rspec/observer/observer_generator_spec.rb +3 -3
  41. data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +34 -34
  42. data/spec/generators/rspec/view/view_generator_spec.rb +6 -6
  43. data/spec/rspec/rails/assertion_adapter_spec.rb +3 -3
  44. data/spec/rspec/rails/configuration_spec.rb +2 -2
  45. data/spec/rspec/rails/deprecations_spec.rb +1 -1
  46. data/spec/rspec/rails/example/controller_example_group_spec.rb +79 -20
  47. data/spec/rspec/rails/example/feature_example_group_spec.rb +2 -2
  48. data/spec/rspec/rails/example/helper_example_group_spec.rb +12 -12
  49. data/spec/rspec/rails/example/mailer_example_group_spec.rb +3 -3
  50. data/spec/rspec/rails/example/model_example_group_spec.rb +3 -3
  51. data/spec/rspec/rails/example/request_example_group_spec.rb +5 -5
  52. data/spec/rspec/rails/example/routing_example_group_spec.rb +5 -5
  53. data/spec/rspec/rails/example/view_example_group_spec.rb +44 -29
  54. data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +3 -3
  55. data/spec/rspec/rails/fixture_support_spec.rb +3 -3
  56. data/spec/rspec/rails/matchers/be_a_new_spec.rb +17 -17
  57. data/spec/rspec/rails/matchers/be_new_record_spec.rb +2 -2
  58. data/spec/rspec/rails/matchers/be_routable_spec.rb +8 -8
  59. data/spec/rspec/rails/matchers/be_valid_spec.rb +33 -4
  60. data/spec/rspec/rails/matchers/has_spec.rb +1 -1
  61. data/spec/rspec/rails/matchers/have_rendered_spec.rb +3 -3
  62. data/spec/rspec/rails/matchers/redirect_to_spec.rb +7 -6
  63. data/spec/rspec/rails/matchers/relation_match_array_spec.rb +6 -6
  64. data/spec/rspec/rails/matchers/route_to_spec.rb +21 -21
  65. data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +9 -0
  66. data/spec/rspec/rails/mocks/mock_model_spec.rb +95 -73
  67. data/spec/rspec/rails/mocks/stub_model_spec.rb +23 -23
  68. data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +4 -4
  69. data/spec/rspec/rails/view_rendering_spec.rb +14 -14
  70. data/spec/spec_helper.rb +3 -5
  71. data/spec/support/helpers.rb +15 -1
  72. metadata +112 -46
  73. metadata.gz.sig +0 -0
  74. checksums.yaml +0 -15
  75. checksums.yaml.gz.sig +0 -2
@@ -8,14 +8,14 @@ module RSpec::Rails
8
8
  Rails.stub_chain(:configuration, :action_mailer, :default_url_options).and_return({})
9
9
  end
10
10
 
11
- it { should be_included_in_files_in('./spec/mailers/') }
12
- it { should be_included_in_files_in('.\\spec\\mailers\\') }
11
+ it { is_expected.to be_included_in_files_in('./spec/mailers/') }
12
+ it { is_expected.to be_included_in_files_in('.\\spec\\mailers\\') }
13
13
 
14
14
  it "adds :type => :mailer to the metadata" do
15
15
  group = RSpec::Core::ExampleGroup.describe do
16
16
  include MailerExampleGroup
17
17
  end
18
- group.metadata[:type].should eq(:mailer)
18
+ expect(group.metadata[:type]).to eq(:mailer)
19
19
  end
20
20
  end
21
21
  end
@@ -2,14 +2,14 @@ require "spec_helper"
2
2
 
3
3
  module RSpec::Rails
4
4
  describe ModelExampleGroup do
5
- it { should be_included_in_files_in('./spec/models/') }
6
- it { should be_included_in_files_in('.\\spec\\models\\') }
5
+ it { is_expected.to be_included_in_files_in('./spec/models/') }
6
+ it { is_expected.to be_included_in_files_in('.\\spec\\models\\') }
7
7
 
8
8
  it "adds :type => :model to the metadata" do
9
9
  group = RSpec::Core::ExampleGroup.describe do
10
10
  include ModelExampleGroup
11
11
  end
12
- group.metadata[:type].should eq(:model)
12
+ expect(group.metadata[:type]).to eq(:model)
13
13
  end
14
14
  end
15
15
  end
@@ -2,16 +2,16 @@ require "spec_helper"
2
2
 
3
3
  module RSpec::Rails
4
4
  describe RequestExampleGroup do
5
- it { should be_included_in_files_in('./spec/requests/') }
6
- it { should be_included_in_files_in('./spec/integration/') }
7
- it { should be_included_in_files_in('.\\spec\\requests\\') }
8
- it { should be_included_in_files_in('.\\spec\\integration\\') }
5
+ it { is_expected.to be_included_in_files_in('./spec/requests/') }
6
+ it { is_expected.to be_included_in_files_in('./spec/integration/') }
7
+ it { is_expected.to be_included_in_files_in('.\\spec\\requests\\') }
8
+ it { is_expected.to be_included_in_files_in('.\\spec\\integration\\') }
9
9
 
10
10
  it "adds :type => :request to the metadata" do
11
11
  group = RSpec::Core::ExampleGroup.describe do
12
12
  include RequestExampleGroup
13
13
  end
14
- group.metadata[:type].should eq(:request)
14
+ expect(group.metadata[:type]).to eq(:request)
15
15
  end
16
16
  end
17
17
  end
@@ -2,14 +2,14 @@ require "spec_helper"
2
2
 
3
3
  module RSpec::Rails
4
4
  describe RoutingExampleGroup do
5
- it { should be_included_in_files_in('./spec/routing/') }
6
- it { should be_included_in_files_in('.\\spec\\routing\\') }
5
+ it { is_expected.to be_included_in_files_in('./spec/routing/') }
6
+ it { is_expected.to be_included_in_files_in('.\\spec\\routing\\') }
7
7
 
8
8
  it "adds :type => :routing to the metadata" do
9
9
  group = RSpec::Core::ExampleGroup.describe do
10
10
  include RoutingExampleGroup
11
11
  end
12
- group.metadata[:type].should eq(:routing)
12
+ expect(group.metadata[:type]).to eq(:routing)
13
13
  end
14
14
 
15
15
  describe "named routes" do
@@ -23,9 +23,9 @@ module RSpec::Rails
23
23
  # Yes, this is quite invasive
24
24
  url_helpers = double('url_helpers', :foo_path => "foo")
25
25
  routes = double('routes', :url_helpers => url_helpers)
26
- example.stub(:routes => routes)
26
+ allow(example).to receive_messages(:routes => routes)
27
27
 
28
- example.foo_path.should == "foo"
28
+ expect(example.foo_path).to eq("foo")
29
29
  end
30
30
  end
31
31
  end
@@ -2,14 +2,14 @@ require "spec_helper"
2
2
 
3
3
  module RSpec::Rails
4
4
  describe ViewExampleGroup do
5
- it { should be_included_in_files_in('./spec/views/') }
6
- it { should be_included_in_files_in('.\\spec\\views\\') }
5
+ it { is_expected.to be_included_in_files_in('./spec/views/') }
6
+ it { is_expected.to be_included_in_files_in('.\\spec\\views\\') }
7
7
 
8
8
  it "adds :type => :view to the metadata" do
9
9
  group = RSpec::Core::ExampleGroup.describe do
10
10
  include ViewExampleGroup
11
11
  end
12
- group.metadata[:type].should eq(:view)
12
+ expect(group.metadata[:type]).to eq(:view)
13
13
  end
14
14
 
15
15
  describe 'automatic inclusion of helpers' do
@@ -18,7 +18,7 @@ module RSpec::Rails
18
18
 
19
19
  it 'includes the helper with the same name' do
20
20
  group = RSpec::Core::ExampleGroup.describe 'things/show.html.erb'
21
- group.should_receive(:helper).with(ThingsHelper)
21
+ expect(group).to receive(:helper).with(ThingsHelper)
22
22
  group.class_eval do
23
23
  include ViewExampleGroup
24
24
  end
@@ -26,7 +26,7 @@ module RSpec::Rails
26
26
 
27
27
  it 'includes the namespaced helper with the same name' do
28
28
  group = RSpec::Core::ExampleGroup.describe 'namespaced/things/show.html.erb'
29
- group.should_receive(:helper).with(Namespaced::ThingsHelper)
29
+ expect(group).to receive(:helper).with(Namespaced::ThingsHelper)
30
30
  group.class_eval do
31
31
  include ViewExampleGroup
32
32
  end
@@ -34,11 +34,11 @@ module RSpec::Rails
34
34
 
35
35
  it 'operates normally when no helper with the same name exists' do
36
36
  raise 'unexpected constant found' if Object.const_defined?('ClocksHelper')
37
- lambda {
37
+ expect {
38
38
  RSpec::Core::ExampleGroup.describe 'clocks/show.html.erb' do
39
39
  include ViewExampleGroup
40
40
  end
41
- }.should_not raise_error
41
+ }.not_to raise_error
42
42
  end
43
43
 
44
44
  context 'application helper exists' do
@@ -57,7 +57,7 @@ module RSpec::Rails
57
57
 
58
58
  it 'includes the application helper' do
59
59
  group = RSpec::Core::Example.describe 'bars/new.html.erb'
60
- group.should_receive(:helper).with(ApplicationHelper)
60
+ expect(group).to receive(:helper).with(ApplicationHelper)
61
61
  group.class_eval do
62
62
  include ViewExampleGroup
63
63
  end
@@ -79,11 +79,11 @@ module RSpec::Rails
79
79
  end
80
80
 
81
81
  it 'operates normally' do
82
- lambda {
82
+ expect {
83
83
  RSpec::Core::ExampleGroup.describe 'foos/edit.html.erb' do
84
84
  include ViewExampleGroup
85
85
  end
86
- }.should_not raise_error
86
+ }.not_to raise_error
87
87
  end
88
88
  end
89
89
  end
@@ -109,19 +109,19 @@ module RSpec::Rails
109
109
 
110
110
  context "given no input" do
111
111
  it "sends render(:template => (described file)) to the view" do
112
- view_spec.stub(:_default_file_to_render) { "widgets/new" }
112
+ allow(view_spec).to receive(:_default_file_to_render) { "widgets/new" }
113
113
  view_spec.render
114
- view_spec.received.first.should == [{:template => "widgets/new"},{}, nil]
114
+ expect(view_spec.received.first).to eq([{:template => "widgets/new"},{}, nil])
115
115
  end
116
116
 
117
117
  it "converts the filename components into render options" do
118
- view_spec.stub(:_default_file_to_render) { "widgets/new.en.html.erb" }
118
+ allow(view_spec).to receive(:_default_file_to_render) { "widgets/new.en.html.erb" }
119
119
  view_spec.render
120
120
 
121
121
  if ::Rails::VERSION::STRING >= '3.2'
122
- view_spec.received.first.should == [{:template => "widgets/new", :locales=>['en'], :formats=>['html'], :handlers=>['erb']}, {}, nil]
122
+ expect(view_spec.received.first).to eq([{:template => "widgets/new", :locales=>['en'], :formats=>['html'], :handlers=>['erb']}, {}, nil])
123
123
  else
124
- view_spec.received.first.should == [{:template => "widgets/new.en.html.erb"}, {}, nil]
124
+ expect(view_spec.received.first).to eq([{:template => "widgets/new.en.html.erb"}, {}, nil])
125
125
  end
126
126
  end
127
127
  end
@@ -129,14 +129,14 @@ module RSpec::Rails
129
129
  context "given a string" do
130
130
  it "sends string as the first arg to render" do
131
131
  view_spec.render('arbitrary/path')
132
- view_spec.received.first.should == ["arbitrary/path", {}, nil]
132
+ expect(view_spec.received.first).to eq(["arbitrary/path", {}, nil])
133
133
  end
134
134
  end
135
135
 
136
136
  context "given a hash" do
137
137
  it "sends the hash as the first arg to render" do
138
138
  view_spec.render(:foo => 'bar')
139
- view_spec.received.first.should == [{:foo => "bar"}, {}, nil]
139
+ expect(view_spec.received.first).to eq([{:foo => "bar"}, {}, nil])
140
140
  end
141
141
  end
142
142
  end
@@ -152,7 +152,7 @@ module RSpec::Rails
152
152
  end
153
153
 
154
154
  it 'delegates to the controller' do
155
- view_spec.controller.should_receive(:params).and_return({})
155
+ expect(view_spec.controller).to receive(:params).and_return({})
156
156
  view_spec.params[:foo] = 1
157
157
  end
158
158
  end
@@ -165,19 +165,19 @@ module RSpec::Rails
165
165
  end
166
166
  context "with a common _default_file_to_render" do
167
167
  it "it returns the directory" do
168
- view_spec.stub(:_default_file_to_render).
168
+ allow(view_spec).to receive(:_default_file_to_render).
169
169
  and_return("things/new.html.erb")
170
- view_spec.__send__(:_controller_path).
171
- should == "things"
170
+ expect(view_spec.__send__(:_controller_path)).
171
+ to eq("things")
172
172
  end
173
173
  end
174
174
 
175
175
  context "with a nested _default_file_to_render" do
176
176
  it "it returns the directory path" do
177
- view_spec.stub(:_default_file_to_render).
177
+ allow(view_spec).to receive(:_default_file_to_render).
178
178
  and_return("admin/things/new.html.erb")
179
- view_spec.__send__(:_controller_path).
180
- should == "admin/things"
179
+ expect(view_spec.__send__(:_controller_path)).
180
+ to eq("admin/things")
181
181
  end
182
182
  end
183
183
  end
@@ -191,8 +191,23 @@ module RSpec::Rails
191
191
 
192
192
  it "delegates to _view" do
193
193
  view = double("view")
194
- view_spec.stub(:_view) { view }
195
- view_spec.view.should == view
194
+ allow(view_spec).to receive(:_view) { view }
195
+ expect(view_spec.view).to eq(view)
196
+ end
197
+
198
+ it 'is accessible to hooks' do
199
+ with_isolated_config do
200
+ run_count = 0
201
+ RSpec.configuration.before(:each, :type => :view) do
202
+ allow(view).to receive(:a_stubbed_helper) { :value }
203
+ run_count += 1
204
+ end
205
+ group = RSpec::Core::ExampleGroup.describe 'a view', :type => :view do
206
+ specify { true }
207
+ end
208
+ group.run NullObject.new
209
+ expect(run_count).to eq 1
210
+ end
196
211
  end
197
212
  end
198
213
 
@@ -204,15 +219,15 @@ module RSpec::Rails
204
219
  end.new
205
220
  end
206
221
 
207
- before { RSpec.stub(:deprecate) }
222
+ before { allow(RSpec).to receive(:deprecate) }
208
223
 
209
224
  it "is deprecated" do
210
- RSpec.should_receive(:deprecate)
225
+ expect(RSpec).to receive(:deprecate)
211
226
  view_spec.template
212
227
  end
213
228
 
214
229
  it "delegates to #view" do
215
- view_spec.should_receive(:view)
230
+ expect(view_spec).to receive(:view)
216
231
  view_spec.template
217
232
  end
218
233
  end
@@ -9,15 +9,15 @@ describe "errors_on" do
9
9
 
10
10
  it "calls valid?" do
11
11
  model = klass.new
12
- model.should_receive(:valid?)
12
+ expect(model).to receive(:valid?)
13
13
  model.errors_on(:foo)
14
14
  end
15
15
 
16
16
  it "returns the errors on that attribute" do
17
17
  model = klass.new
18
- model.stub(:errors) do
18
+ allow(model).to receive(:errors) do
19
19
  { :foo => ['a', 'b'] }
20
20
  end
21
- model.errors_on(:foo).should eq(['a','b'])
21
+ expect(model.errors_on(:foo)).to eq(['a','b'])
22
22
  end
23
23
  end
@@ -4,13 +4,13 @@ module RSpec::Rails
4
4
  describe FixtureSupport do
5
5
  context "with use_transactional_fixtures set to false" do
6
6
  it "still supports fixture_path" do
7
- RSpec.configuration.stub(:use_transactional_fixtures) { false }
7
+ allow(RSpec.configuration).to receive(:use_transactional_fixtures) { false }
8
8
  group = RSpec::Core::ExampleGroup.describe do
9
9
  include FixtureSupport
10
10
  end
11
11
 
12
- group.should respond_to(:fixture_path)
13
- group.should respond_to(:fixture_path=)
12
+ expect(group).to respond_to(:fixture_path)
13
+ expect(group).to respond_to(:fixture_path=)
14
14
  end
15
15
  end
16
16
  end
@@ -11,12 +11,12 @@ describe "be_a_new matcher" do
11
11
  end
12
12
  context "right class" do
13
13
  it "passes" do
14
- record.should be_a_new(record.class)
14
+ expect(record).to be_a_new(record.class)
15
15
  end
16
16
  end
17
17
  context "wrong class" do
18
18
  it "fails" do
19
- record.should_not be_a_new(String)
19
+ expect(record).not_to be_a_new(String)
20
20
  end
21
21
  end
22
22
  end
@@ -29,12 +29,12 @@ describe "be_a_new matcher" do
29
29
  end
30
30
  context "right class" do
31
31
  it "fails" do
32
- record.should_not be_a_new(record.class)
32
+ expect(record).not_to be_a_new(record.class)
33
33
  end
34
34
  end
35
35
  context "wrong class" do
36
36
  it "fails" do
37
- record.should_not be_a_new(String)
37
+ expect(record).not_to be_a_new(String)
38
38
  end
39
39
  end
40
40
  end
@@ -57,24 +57,24 @@ describe "be_a_new matcher" do
57
57
 
58
58
  context "all attributes same" do
59
59
  it "passes" do
60
- record.should be_a_new(record.class).with(:foo => 'foo', :bar => 'bar')
60
+ expect(record).to be_a_new(record.class).with(:foo => 'foo', :bar => 'bar')
61
61
  end
62
62
  end
63
63
 
64
64
  context "one attribute same" do
65
65
  it "passes" do
66
- record.should be_a_new(record.class).with(:foo => 'foo')
66
+ expect(record).to be_a_new(record.class).with(:foo => 'foo')
67
67
  end
68
68
  end
69
69
 
70
70
  context "no attributes same" do
71
71
  it "fails" do
72
72
  expect {
73
- record.should be_a_new(record.class).with(:zoo => 'zoo', :car => 'car')
73
+ expect(record).to be_a_new(record.class).with(:zoo => 'zoo', :car => 'car')
74
74
  }.to raise_error {|e|
75
- e.message.should match(/attributes {.*} were not set on #{record.inspect}/)
76
- e.message.should match(/"zoo"=>"zoo"/)
77
- e.message.should match(/"car"=>"car"/)
75
+ expect(e.message).to match(/attributes {.*} were not set on #{record.inspect}/)
76
+ expect(e.message).to match(/"zoo"=>"zoo"/)
77
+ expect(e.message).to match(/"car"=>"car"/)
78
78
  }
79
79
  end
80
80
  end
@@ -82,7 +82,7 @@ describe "be_a_new matcher" do
82
82
  context "one attribute value not the same" do
83
83
  it "fails" do
84
84
  expect {
85
- record.should be_a_new(record.class).with(:foo => 'bar')
85
+ expect(record).to be_a_new(record.class).with(:foo => 'bar')
86
86
  }.to raise_error(
87
87
  %Q(attribute {"foo"=>"bar"} was not set on #{record.inspect})
88
88
  )
@@ -108,7 +108,7 @@ describe "be_a_new matcher" do
108
108
  context "all attributes same" do
109
109
  it "fails" do
110
110
  expect {
111
- record.should be_a_new(String).with(:foo => 'foo', :bar => 'bar')
111
+ expect(record).to be_a_new(String).with(:foo => 'foo', :bar => 'bar')
112
112
  }.to raise_error(
113
113
  "expected #{record.inspect} to be a new String"
114
114
  )
@@ -118,11 +118,11 @@ describe "be_a_new matcher" do
118
118
  context "no attributes same" do
119
119
  it "fails" do
120
120
  expect {
121
- record.should be_a_new(String).with(:zoo => 'zoo', :car => 'car')
121
+ expect(record).to be_a_new(String).with(:zoo => 'zoo', :car => 'car')
122
122
  }.to raise_error {|e|
123
- e.message.should match(/expected #{record.inspect} to be a new String and attributes {.*} were not set on #{record.inspect}/)
124
- e.message.should match(/"zoo"=>"zoo"/)
125
- e.message.should match(/"car"=>"car"/)
123
+ expect(e.message).to match(/expected #{record.inspect} to be a new String and attributes {.*} were not set on #{record.inspect}/)
124
+ expect(e.message).to match(/"zoo"=>"zoo"/)
125
+ expect(e.message).to match(/"car"=>"car"/)
126
126
  }
127
127
  end
128
128
  end
@@ -130,7 +130,7 @@ describe "be_a_new matcher" do
130
130
  context "one attribute value not the same" do
131
131
  it "fails" do
132
132
  expect {
133
- record.should be_a_new(String).with(:foo => 'bar')
133
+ expect(record).to be_a_new(String).with(:foo => 'bar')
134
134
  }.to raise_error(
135
135
  "expected #{record.inspect} to be a new String and " +
136
136
  %Q(attribute {"foo"=>"bar"} was not set on #{record.inspect})
@@ -7,7 +7,7 @@ describe "be_new_record" do
7
7
  let(:record) { double('record', :persisted? => false) }
8
8
 
9
9
  it "passes" do
10
- record.should be_new_record
10
+ expect(record).to be_new_record
11
11
  end
12
12
 
13
13
  it "fails with custom failure message" do
@@ -21,7 +21,7 @@ describe "be_new_record" do
21
21
  let(:record) { double('record', :persisted? => true) }
22
22
 
23
23
  it "fails" do
24
- record.should_not be_new_record
24
+ expect(record).not_to be_new_record
25
25
  end
26
26
 
27
27
  it "fails with custom failure message" do
@@ -8,16 +8,16 @@ describe "be_routable" do
8
8
 
9
9
  context "with should" do
10
10
  it "passes if routes recognize the path" do
11
- routes.stub(:recognize_path) { {} }
11
+ allow(routes).to receive(:recognize_path) { {} }
12
12
  expect do
13
- {:get => "/a/path"}.should be_routable
13
+ expect({:get => "/a/path"}).to be_routable
14
14
  end.to_not raise_error
15
15
  end
16
16
 
17
17
  it "fails if routes do not recognize the path" do
18
- routes.stub(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
18
+ allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
19
19
  expect do
20
- {:get => "/a/path"}.should be_routable
20
+ expect({:get => "/a/path"}).to be_routable
21
21
  end.to raise_error(/expected \{:get=>"\/a\/path"\} to be routable/)
22
22
  end
23
23
  end
@@ -25,16 +25,16 @@ describe "be_routable" do
25
25
  context "with should_not" do
26
26
 
27
27
  it "passes if routes do not recognize the path" do
28
- routes.stub(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
28
+ allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
29
29
  expect do
30
- {:get => "/a/path"}.should_not be_routable
30
+ expect({:get => "/a/path"}).not_to be_routable
31
31
  end.to_not raise_error
32
32
  end
33
33
 
34
34
  it "fails if routes recognize the path" do
35
- routes.stub(:recognize_path) { {:controller => "foo"} }
35
+ allow(routes).to receive(:recognize_path) { {:controller => "foo"} }
36
36
  expect do
37
- {:get => "/a/path"}.should_not be_routable
37
+ expect({:get => "/a/path"}).not_to be_routable
38
38
  end.to raise_error(/expected \{:get=>"\/a\/path"\} not to be routable, but it routes to \{:controller=>"foo"\}/)
39
39
  end
40
40
  end