File tree Expand file tree Collapse file tree 2 files changed +18
-23
lines changed
features/controller_specs Expand file tree Collapse file tree 2 files changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -34,29 +34,6 @@ Feature: controller spec
34
34
When I run `rspec spec`
35
35
Then the example should pass
36
36
37
- Scenario : controller is extended with a helper module
38
- Given a file named "spec/controllers/widgets_controller_spec.rb" with:
39
- """ruby
40
- require "rails_helper"
41
-
42
- module MyHelper
43
- def my_variable
44
- end
45
- end
46
-
47
- RSpec.configure {|c| c.include MyHelper }
48
-
49
- RSpec.describe WidgetsController, :type => :controller do
50
- let(:my_variable) { 'is a value' }
51
-
52
- describe 'something' do
53
- specify { expect(my_variable).to eq 'is a value' }
54
- end
55
- end
56
- """
57
- When I run `rspec spec`
58
- Then the example should pass
59
-
60
37
Scenario : setting a different content type for example json (request type)
61
38
Given a file named "spec/controllers/widgets_controller_spec.rb" with:
62
39
"""ruby
Original file line number Diff line number Diff line change @@ -28,6 +28,24 @@ def group_for(klass)
28
28
allow ( example ) . to receive_messages ( :controller => controller )
29
29
expect ( example . subject ) . to eq ( controller )
30
30
end
31
+
32
+ it "doesn't cause let definition priority to be changed" do
33
+ # before #738 implicit subject definition for controllers caused
34
+ # external methods to take precedence over our let definitions
35
+
36
+ with_isolated_config do |config |
37
+ mod = Module . new do
38
+ def my_helper
39
+ "other_value"
40
+ end
41
+ end
42
+ config . include mod
43
+ group . class_exec do
44
+ let ( :my_helper ) { "my_value" }
45
+ end
46
+ expect ( group . new . my_helper ) . to eq "my_value"
47
+ end
48
+ end
31
49
end
32
50
33
51
context "with explicit subject" do
You can’t perform that action at this time.
0 commit comments