rspec-rails 3.0.0.beta1 → 3.0.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -14,8 +14,8 @@ describe Rspec::Generators::ObserverGenerator do
14
14
  end
15
15
 
16
16
  describe 'the spec' do
17
- it { should exist }
18
- it { should contain(/require 'spec_helper'/) }
19
- it { should contain(/describe PostsObserver/) }
17
+ it { is_expected.to exist }
18
+ it { is_expected.to contain(/require 'spec_helper'/) }
19
+ it { is_expected.to contain(/describe PostsObserver/) }
20
20
  end
21
21
  end
@@ -12,14 +12,14 @@ describe Rspec::Generators::ScaffoldGenerator do
12
12
 
13
13
  describe 'with no options' do
14
14
  before { run_generator %w(posts) }
15
- it { should contain(/require 'spec_helper'/) }
16
- it { should contain(/describe PostsController/) }
17
- it { should contain(%({ "these" => "params" })) }
15
+ it { is_expected.to contain(/require 'spec_helper'/) }
16
+ it { is_expected.to contain(/describe PostsController/) }
17
+ it { is_expected.to contain(%({ "these" => "params" })) }
18
18
  end
19
19
 
20
20
  describe 'with --no-controller_specs' do
21
21
  before { run_generator %w(posts --no-controller_specs) }
22
- it { should_not exist }
22
+ it { is_expected.not_to exist }
23
23
  end
24
24
  end
25
25
 
@@ -27,13 +27,13 @@ describe Rspec::Generators::ScaffoldGenerator do
27
27
  subject { file('spec/controllers/posts_controller_spec.rb') }
28
28
  before { run_generator %w(posts title:string) }
29
29
 
30
- it { should contain(%({ "title" => "MyString" })) }
30
+ it { is_expected.to contain(%({ "title" => "MyString" })) }
31
31
  end
32
32
 
33
33
  describe 'namespaced controller spec' do
34
34
  subject { file('spec/controllers/admin/posts_controller_spec.rb') }
35
35
  before { run_generator %w(admin/posts) }
36
- it { should contain(/describe Admin::PostsController/)}
36
+ it { is_expected.to contain(/describe Admin::PostsController/)}
37
37
  end
38
38
 
39
39
  describe 'view specs' do
@@ -41,34 +41,34 @@ describe Rspec::Generators::ScaffoldGenerator do
41
41
  before { run_generator %w(posts) }
42
42
  describe 'edit' do
43
43
  subject { file("spec/views/posts/edit.html.erb_spec.rb") }
44
- it { should exist }
45
- it { should contain(/require 'spec_helper'/) }
46
- it { should contain(/describe "(.*)\/edit"/) }
47
- it { should contain(/it "renders the edit (.*) form"/) }
44
+ it { is_expected.to exist }
45
+ it { is_expected.to contain(/require 'spec_helper'/) }
46
+ it { is_expected.to contain(/describe "(.*)\/edit"/) }
47
+ it { is_expected.to contain(/it "renders the edit (.*) form"/) }
48
48
  end
49
49
 
50
50
  describe 'index' do
51
51
  subject { file("spec/views/posts/index.html.erb_spec.rb") }
52
- it { should exist }
53
- it { should contain(/require 'spec_helper'/) }
54
- it { should contain(/describe "(.*)\/index"/) }
55
- it { should contain(/it "renders a list of (.*)"/) }
52
+ it { is_expected.to exist }
53
+ it { is_expected.to contain(/require 'spec_helper'/) }
54
+ it { is_expected.to contain(/describe "(.*)\/index"/) }
55
+ it { is_expected.to contain(/it "renders a list of (.*)"/) }
56
56
  end
57
57
 
58
58
  describe 'new' do
59
59
  subject { file("spec/views/posts/new.html.erb_spec.rb") }
60
- it { should exist }
61
- it { should contain(/require 'spec_helper'/) }
62
- it { should contain(/describe "(.*)\/new"/) }
63
- it { should contain(/it "renders new (.*) form"/) }
60
+ it { is_expected.to exist }
61
+ it { is_expected.to contain(/require 'spec_helper'/) }
62
+ it { is_expected.to contain(/describe "(.*)\/new"/) }
63
+ it { is_expected.to contain(/it "renders new (.*) form"/) }
64
64
  end
65
65
 
66
66
  describe 'show' do
67
67
  subject { file("spec/views/posts/show.html.erb_spec.rb") }
68
- it { should exist }
69
- it { should contain(/require 'spec_helper'/) }
70
- it { should contain(/describe "(.*)\/show"/) }
71
- it { should contain(/it "renders attributes in <p>"/) }
68
+ it { is_expected.to exist }
69
+ it { is_expected.to contain(/require 'spec_helper'/) }
70
+ it { is_expected.to contain(/describe "(.*)\/show"/) }
71
+ it { is_expected.to contain(/it "renders attributes in <p>"/) }
72
72
  end
73
73
  end
74
74
 
@@ -76,22 +76,22 @@ describe Rspec::Generators::ScaffoldGenerator do
76
76
  before { run_generator %w(posts --no-template-engine) }
77
77
  describe 'edit' do
78
78
  subject { file("spec/views/posts/edit.html._spec.rb") }
79
- it { should_not exist }
79
+ it { is_expected.not_to exist }
80
80
  end
81
81
 
82
82
  describe 'index' do
83
83
  subject { file("spec/views/posts/index.html._spec.rb") }
84
- it { should_not exist }
84
+ it { is_expected.not_to exist }
85
85
  end
86
86
 
87
87
  describe 'new' do
88
88
  subject { file("spec/views/posts/new.html._spec.rb") }
89
- it { should_not exist }
89
+ it { is_expected.not_to exist }
90
90
  end
91
91
 
92
92
  describe 'show' do
93
93
  subject { file("spec/views/posts/show.html._spec.rb") }
94
- it { should_not exist }
94
+ it { is_expected.not_to exist }
95
95
  end
96
96
  end
97
97
 
@@ -100,22 +100,22 @@ describe Rspec::Generators::ScaffoldGenerator do
100
100
 
101
101
  describe 'edit' do
102
102
  subject { file("spec/views/posts/edit.html.erb_spec.rb") }
103
- it { should_not exist }
103
+ it { is_expected.not_to exist }
104
104
  end
105
105
 
106
106
  describe 'index' do
107
107
  subject { file("spec/views/posts/index.html.erb_spec.rb") }
108
- it { should_not exist }
108
+ it { is_expected.not_to exist }
109
109
  end
110
110
 
111
111
  describe 'new' do
112
112
  subject { file("spec/views/posts/new.html.erb_spec.rb") }
113
- it { should_not exist }
113
+ it { is_expected.not_to exist }
114
114
  end
115
115
 
116
116
  describe 'show' do
117
117
  subject { file("spec/views/posts/show.html.erb_spec.rb") }
118
- it { should_not exist }
118
+ it { is_expected.not_to exist }
119
119
  end
120
120
  end
121
121
  end
@@ -125,14 +125,14 @@ describe Rspec::Generators::ScaffoldGenerator do
125
125
 
126
126
  describe 'with default options' do
127
127
  before { run_generator %w(posts) }
128
- it { should contain(/require "spec_helper"/) }
129
- it { should contain(/describe PostsController/) }
130
- it { should contain(/describe "routing"/) }
128
+ it { is_expected.to contain(/require "spec_helper"/) }
129
+ it { is_expected.to contain(/describe PostsController/) }
130
+ it { is_expected.to contain(/describe "routing"/) }
131
131
  end
132
132
 
133
133
  describe 'with --no-routing-specs' do
134
134
  before { run_generator %w(posts --no-routing_specs) }
135
- it { should_not exist }
135
+ it { is_expected.not_to exist }
136
136
  end
137
137
  end
138
138
  end
@@ -13,8 +13,8 @@ describe Rspec::Generators::ViewGenerator do
13
13
  it 'generates a spec for the supplied action' do
14
14
  run_generator %w(posts index)
15
15
  file('spec/views/posts/index.html.erb_spec.rb').tap do |f|
16
- f.should contain(/require 'spec_helper'/)
17
- f.should contain(/describe "posts\/index"/)
16
+ expect(f).to contain(/require 'spec_helper'/)
17
+ expect(f).to contain(/describe "posts\/index"/)
18
18
  end
19
19
  end
20
20
 
@@ -22,8 +22,8 @@ describe Rspec::Generators::ViewGenerator do
22
22
  it 'generates a spec for the supplied action' do
23
23
  run_generator %w(admin/posts index)
24
24
  file('spec/views/admin/posts/index.html.erb_spec.rb').tap do |f|
25
- f.should contain(/require 'spec_helper'/)
26
- f.should contain(/describe "admin\/posts\/index"/)
25
+ expect(f).to contain(/require 'spec_helper'/)
26
+ expect(f).to contain(/describe "admin\/posts\/index"/)
27
27
  end
28
28
  end
29
29
  end
@@ -33,8 +33,8 @@ describe Rspec::Generators::ViewGenerator do
33
33
  it 'generates a spec for the supplied action' do
34
34
  run_generator %w(posts index --template_engine haml)
35
35
  file('spec/views/posts/index.html.haml_spec.rb').tap do |f|
36
- f.should contain(/require 'spec_helper'/)
37
- f.should contain(/describe "posts\/index"/)
36
+ expect(f).to contain(/require 'spec_helper'/)
37
+ expect(f).to contain(/describe "posts\/index"/)
38
38
  end
39
39
  end
40
40
  end
@@ -13,16 +13,16 @@ describe RSpec::Rails::MinitestAssertionAdapter do
13
13
  end
14
14
  else
15
15
  it "exposes #{m} to host examples" do
16
- methods.should include(m)
16
+ expect(methods).to include(m)
17
17
  end
18
18
  end
19
19
  end
20
20
 
21
21
  it "does not expose internal methods of Minitest" do
22
- methods.should_not include("_assertions")
22
+ expect(methods).not_to include("_assertions")
23
23
  end
24
24
 
25
25
  it "does not expose Minitest's message method" do
26
- methods.should_not include("message")
26
+ expect(methods).not_to include("message")
27
27
  end
28
28
  end
@@ -11,7 +11,7 @@ describe "configuration" do
11
11
 
12
12
  describe "#render_views?" do
13
13
  it "is false by default" do
14
- RSpec.configuration.render_views?.should be_falsey
14
+ expect(RSpec.configuration.render_views?).to be_falsey
15
15
  end
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ describe "configuration" do
20
20
  RSpec.configuration.render_views = false
21
21
  RSpec.configuration.render_views
22
22
 
23
- RSpec.configuration.render_views?.should be_truthy
23
+ expect(RSpec.configuration.render_views?).to be_truthy
24
24
  end
25
25
  end
26
26
  end
@@ -10,7 +10,7 @@ describe "rspec-rails-2 deprecations" do
10
10
  end
11
11
 
12
12
  it "is deprecated" do
13
- RSpec.should_receive(:deprecate)
13
+ expect(RSpec).to receive(:deprecate)
14
14
  group.integrate_views
15
15
  end
16
16
  end
@@ -1,12 +1,13 @@
1
1
  require "spec_helper"
2
2
 
3
3
  class ::ApplicationController
4
+ def self.abstract?; false; end
4
5
  end
5
6
 
6
7
  module RSpec::Rails
7
8
  describe ControllerExampleGroup do
8
- it { should be_included_in_files_in('./spec/controllers/') }
9
- it { should be_included_in_files_in('.\\spec\\controllers\\') }
9
+ it { is_expected.to be_included_in_files_in('./spec/controllers/') }
10
+ it { is_expected.to be_included_in_files_in('.\\spec\\controllers\\') }
10
11
 
11
12
  let(:group) do
12
13
  RSpec::Core::ExampleGroup.describe do
@@ -15,19 +16,19 @@ module RSpec::Rails
15
16
  end
16
17
 
17
18
  it "includes routing matchers" do
18
- group.included_modules.should include(RSpec::Rails::Matchers::RoutingMatchers)
19
+ expect(group.included_modules).to include(RSpec::Rails::Matchers::RoutingMatchers)
19
20
  end
20
21
 
21
22
  it "adds :type => :controller to the metadata" do
22
- group.metadata[:type].should eq(:controller)
23
+ expect(group.metadata[:type]).to eq(:controller)
23
24
  end
24
25
 
25
26
  context "with implicit subject" do
26
27
  it "uses the controller as the subject" do
27
28
  controller = double('controller')
28
29
  example = group.new
29
- example.stub(:controller => controller)
30
- example.subject.should == controller
30
+ allow(example).to receive_messages(:controller => controller)
31
+ expect(example.subject).to eq(controller)
31
32
  end
32
33
  end
33
34
 
@@ -35,7 +36,7 @@ module RSpec::Rails
35
36
  it "uses the specified subject instead of the controller" do
36
37
  group.subject { 'explicit' }
37
38
  example = group.new
38
- example.subject.should == 'explicit'
39
+ expect(example.subject).to eq('explicit')
39
40
  end
40
41
  end
41
42
 
@@ -48,10 +49,10 @@ module RSpec::Rails
48
49
 
49
50
  it "delegates named route helpers to the underlying controller" do
50
51
  controller = double('controller')
51
- controller.stub(:foos_url).and_return('http://test.host/foos')
52
+ allow(controller).to receive(:foos_url).and_return('http://test.host/foos')
52
53
 
53
54
  example = group.new
54
- example.stub(:controller => controller)
55
+ allow(example).to receive_messages(:controller => controller)
55
56
 
56
57
  # As in the routing example spec, this is pretty invasive, but not sure
57
58
  # how to do it any other way as the correct operation relies on before
@@ -60,7 +61,7 @@ module RSpec::Rails
60
61
  routes.draw { resources :foos }
61
62
  example.instance_variable_set(:@orig_routes, routes)
62
63
 
63
- example.foos_url.should eq('http://test.host/foos')
64
+ expect(example.foos_url).to eq('http://test.host/foos')
64
65
  end
65
66
  end
66
67
 
@@ -77,23 +78,81 @@ module RSpec::Rails
77
78
 
78
79
  describe "with inferred anonymous controller" do
79
80
  before do
80
- group.stub(:controller_class).and_return(Class.new)
81
+ allow(group).to receive(:controller_class).and_return(Class.new)
81
82
  end
82
83
 
83
- it "infers the anonymous controller class when infer_base_class_for_anonymous_controllers is true" do
84
- RSpec.configuration.stub(:infer_base_class_for_anonymous_controllers?).and_return(true)
85
- group.controller { }
84
+ it "defaults to inferring anonymous controller class" do
85
+ expect(RSpec.configuration.infer_base_class_for_anonymous_controllers).to be_truthy
86
+ end
87
+
88
+ context "when infer_base_class_for_anonymous_controllers is true" do
89
+ before do
90
+ allow(RSpec.configuration).to receive(:infer_base_class_for_anonymous_controllers?).and_return(true)
91
+ end
92
+
93
+ it "infers the anonymous controller class" do
94
+ group.controller { }
95
+
96
+ controller_class = group.metadata[:example_group][:described_class]
97
+ expect(controller_class.superclass).to eq(group.controller_class)
98
+ end
99
+
100
+ it "infers the anonymous controller class when no ApplicationController is present" do
101
+ hide_const '::ApplicationController'
102
+ group.controller { }
103
+
104
+ controller_class = group.metadata[:example_group][:described_class]
105
+ expect(controller_class.superclass).to eq(group.controller_class)
106
+ end
107
+ end
108
+
109
+ context "when infer_base_class_for_anonymous_controllers is false" do
110
+ before do
111
+ allow(RSpec.configuration).to receive(:infer_base_class_for_anonymous_controllers?).and_return(false)
112
+ end
86
113
 
87
- controller_class = group.metadata[:example_group][:described_class]
88
- controller_class.superclass.should eq(group.controller_class)
114
+ it "sets the anonymous controller class to ApplicationController" do
115
+ group.controller { }
116
+
117
+ controller_class = group.metadata[:example_group][:described_class]
118
+ expect(controller_class.superclass).to eq(ApplicationController)
119
+ end
120
+
121
+ it "sets the anonymous controller class to ActiveController::Base when no ApplicationController is present" do
122
+ hide_const '::ApplicationController'
123
+ group.controller { }
124
+
125
+ controller_class = group.metadata[:example_group][:described_class]
126
+ expect(controller_class.superclass).to eq(ActionController::Base)
127
+ end
89
128
  end
129
+ end
130
+
131
+ describe "controller name" do
132
+ let(:controller_class) { group.metadata[:example_group][:described_class] }
90
133
 
91
- it "sets the anonymous controller class to ApplicationController when infer_base_class_for_anonymous_controllers is false" do
92
- RSpec.configuration.stub(:infer_base_class_for_anonymous_controllers?).and_return(false)
134
+ it "sets the name as AnonymousController if it's anonymous" do
93
135
  group.controller { }
136
+ expect(controller_class.name).to eq "AnonymousController"
137
+ end
138
+
139
+ it "sets the name according to defined controller if it is not anonymous" do
140
+ stub_const "FoosController", Class.new(::ApplicationController)
141
+ group.controller(FoosController) { }
142
+ expect(controller_class.name).to eq "FoosController"
143
+ end
144
+
145
+ it "sets name as AnonymousController if defined as ApplicationController" do
146
+ group.controller(ApplicationController) { }
147
+ expect(controller_class.name).to eq "AnonymousController"
148
+ end
149
+
150
+ it "sets name as AnonymousController the controller is abstract" do
151
+ abstract_controller = Class.new(::ApplicationController)
152
+ def abstract_controller.abstract?; true; end
94
153
 
95
- controller_class = group.metadata[:example_group][:described_class]
96
- controller_class.superclass.should eq(ApplicationController)
154
+ group.controller(abstract_controller) { }
155
+ expect(controller_class.name).to eq "AnonymousController"
97
156
  end
98
157
  end
99
158
  end
@@ -2,8 +2,8 @@ require "spec_helper"
2
2
 
3
3
  module RSpec::Rails
4
4
  describe FeatureExampleGroup do
5
- it { should be_included_in_files_in('./spec/features/') }
6
- it { should be_included_in_files_in('.\\spec\\features\\') }
5
+ it { is_expected.to be_included_in_files_in('./spec/features/') }
6
+ it { is_expected.to be_included_in_files_in('.\\spec\\features\\') }
7
7
 
8
8
  it "adds :type => :feature to the metadata" do
9
9
  group = RSpec::Core::ExampleGroup.describe do
@@ -5,32 +5,32 @@ module RSpec::Rails
5
5
  module ::FoosHelper; end
6
6
  subject { HelperExampleGroup }
7
7
 
8
- it { should be_included_in_files_in('./spec/helpers/') }
9
- it { should be_included_in_files_in('.\\spec\\helpers\\') }
8
+ it { is_expected.to be_included_in_files_in('./spec/helpers/') }
9
+ it { is_expected.to be_included_in_files_in('.\\spec\\helpers\\') }
10
10
 
11
11
  it "provides a controller_path based on the helper module's name" do
12
12
  example = double
13
13
  example.stub_chain(:example_group, :described_class) { FoosHelper }
14
14
 
15
15
  helper_spec = Object.new.extend HelperExampleGroup
16
- helper_spec.__send__(:_controller_path, example).should == "foos"
16
+ expect(helper_spec.__send__(:_controller_path, example)).to eq("foos")
17
17
  end
18
18
 
19
19
  it "adds :type => :helper to the metadata" do
20
20
  group = RSpec::Core::ExampleGroup.describe do
21
21
  include HelperExampleGroup
22
22
  end
23
- group.metadata[:type].should eq(:helper)
23
+ expect(group.metadata[:type]).to eq(:helper)
24
24
  end
25
25
 
26
26
  describe "#helper" do
27
27
  it "returns the instance of AV::Base provided by AV::TC::Behavior" do
28
28
  helper_spec = Object.new.extend HelperExampleGroup
29
- helper_spec.should_receive(:view_assigns)
29
+ expect(helper_spec).to receive(:view_assigns)
30
30
  av_tc_b_view = double('_view')
31
- av_tc_b_view.should_receive(:assign)
32
- helper_spec.stub(:_view) { av_tc_b_view }
33
- helper_spec.helper.should eq(av_tc_b_view)
31
+ expect(av_tc_b_view).to receive(:assign)
32
+ allow(helper_spec).to receive(:_view) { av_tc_b_view }
33
+ expect(helper_spec.helper).to eq(av_tc_b_view)
34
34
  end
35
35
 
36
36
  before do
@@ -48,7 +48,7 @@ module RSpec::Rails
48
48
  ActionView::Base.new
49
49
  end
50
50
  end
51
- group.new.helper.should be_kind_of(ApplicationHelper)
51
+ expect(group.new.helper).to be_kind_of(ApplicationHelper)
52
52
  end
53
53
  end
54
54
  end
@@ -57,9 +57,9 @@ module RSpec::Rails
57
57
  describe "determine_default_helper_class" do
58
58
  it "returns the helper module passed to describe" do
59
59
  helper_spec = Object.new.extend HelperExampleGroup::ClassMethods
60
- helper_spec.stub(:described_class) { FoosHelper }
61
- helper_spec.determine_default_helper_class("ignore this").
62
- should eq(FoosHelper)
60
+ allow(helper_spec).to receive(:described_class) { FoosHelper }
61
+ expect(helper_spec.determine_default_helper_class("ignore this")).
62
+ to eq(FoosHelper)
63
63
  end
64
64
  end
65
65
  end