File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -104,3 +104,23 @@ Feature: Transactional examples
104
104
"""
105
105
When I run `rspec spec/models/thing_spec.rb`
106
106
Then the examples should all pass
107
+
108
+ Scenario : Run in transactions with namespaced fixture
109
+ Given a file named "spec/models/thing_spec.rb" with:
110
+ """ruby
111
+ require "rails_helper"
112
+
113
+ RSpec.describe Thing, type: :model do
114
+ fixtures 'namespaced/things'
115
+ it "fixture method defined" do
116
+ namespaced_things(:one)
117
+ end
118
+ end
119
+ """
120
+ Given a file named "spec/fixtures/namespaced/things.yml" with:
121
+ """
122
+ one:
123
+ name: MyString
124
+ """
125
+ When I run `rspec spec/models/thing_spec.rb`
126
+ Then the examples should all pass
Original file line number Diff line number Diff line change @@ -43,14 +43,14 @@ module Fixtures
43
43
if ::Rails . version . to_f >= 7.1
44
44
def fixtures ( *args )
45
45
super . tap do
46
- fixture_sets . each_key do |fixture_name |
47
- proxy_method_warning_if_called_in_before_context_scope ( fixture_name )
46
+ fixture_sets . each_pair do |method_name , fixture_name |
47
+ proxy_method_warning_if_called_in_before_context_scope ( method_name , fixture_name )
48
48
end
49
49
end
50
50
end
51
51
52
- def proxy_method_warning_if_called_in_before_context_scope ( fixture_name )
53
- define_method ( fixture_name ) do |*args , **kwargs , &blk |
52
+ def proxy_method_warning_if_called_in_before_context_scope ( method_name , fixture_name )
53
+ define_method ( method_name ) do |*args , **kwargs , &blk |
54
54
if RSpec . current_scope == :before_context_hook
55
55
RSpec . warn_with ( "Calling fixture method in before :context " )
56
56
else
You can’t perform that action at this time.
0 commit comments