Skip to content

Commit 0db50e9

Browse files
committed
Merge pull request #2738 from rspec/fix-fixture-builds-main
Remove calls to fixture_path on main
1 parent f3d9d63 commit 0db50e9

File tree

2 files changed

+50
-18
lines changed

2 files changed

+50
-18
lines changed

spec/rspec/rails/configuration_spec.rb

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,26 +161,52 @@ def in_inferring_type_from_location_environment
161161
include_examples "infers type from location", :feature, "spec/features"
162162
end
163163

164-
it "fixture support is included with metadata `:use_fixtures`" do
165-
in_sub_process do
166-
a_hash = an_instance_of(Hash)
167-
if ::Rails::VERSION::STRING >= "7.1.0"
168-
expect(RSpec).to receive(:deprecate).with("config.fixture_path = \"custom/path\"", a_hash)
169-
end
170-
164+
if ::Rails::VERSION::STRING >= "7.2.0"
165+
it "fixture support is included with metadata `:use_fixtures`" do
171166
RSpec.configuration.global_fixtures = [:foo]
172-
RSpec.configuration.fixture_path = "custom/path"
167+
RSpec.configuration.fixture_paths = ["custom/path"]
173168

174169
group = RSpec.describe("Arbitrary Description", :use_fixtures)
175170

176-
expect(group).to respond_to(:fixture_path)
171+
expect(group.fixture_paths).to eq(["custom/path"])
177172

178-
if ::Rails::VERSION::STRING >= "7.1.0"
179-
with_isolated_stderr { expect(group.fixture_path).to eq("custom/path") }
180-
else
181-
expect(group.fixture_path).to eq("custom/path")
173+
expect(group.new.respond_to?(:foo, true)).to be(true)
174+
end
175+
elsif ::Rails::VERSION::STRING >= "7.1.0"
176+
it "fixture support is included with metadata `:use_fixtures`" do
177+
in_sub_process do
178+
a_hash = an_instance_of(Hash)
179+
if ::Rails::VERSION::STRING >= "7.1.0"
180+
expect(RSpec).to receive(:deprecate).with("config.fixture_path = \"custom/path\"", a_hash)
181+
end
182+
183+
RSpec.configuration.global_fixtures = [:foo]
184+
RSpec.configuration.fixture_path = "custom/path"
185+
186+
group = RSpec.describe("Arbitrary Description", :use_fixtures)
187+
188+
if ::Rails::VERSION::STRING <= "7.2.0"
189+
expect(group).to respond_to(:fixture_path)
190+
end
191+
192+
if ::Rails::VERSION::STRING >= "7.1.0"
193+
with_isolated_stderr { expect(group.fixture_path).to eq("custom/path") }
194+
else
195+
expect(group.fixture_path).to eq("custom/path")
196+
end
197+
198+
expect(group.new.respond_to?(:foo, true)).to be(true)
182199
end
200+
end
201+
else
202+
it "fixture support is included with metadata `:use_fixtures`" do
203+
RSpec.configuration.global_fixtures = [:foo]
204+
RSpec.configuration.fixture_path = "custom/path"
183205

206+
group = RSpec.describe("Arbitrary Description", :use_fixtures)
207+
208+
expect(group).to respond_to(:fixture_path)
209+
expect(group.fixture_path).to eq("custom/path")
184210
expect(group.new.respond_to?(:foo, true)).to be(true)
185211
end
186212
end

spec/rspec/rails/fixture_support_spec.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ module RSpec::Rails
77
include FixtureSupport
88
end
99

10-
# These are deprecated when Rails is 7.1.0 or above
11-
expect(group).to respond_to(:fixture_path)
12-
expect(group).to respond_to(:fixture_path=)
13-
14-
if ::Rails::VERSION::STRING >= "7.1.0"
10+
if ::Rails::VERSION::STRING >= "7.2.0"
11+
expect(group).to respond_to(:fixture_paths)
12+
expect(group).to respond_to(:fixture_paths=)
13+
elsif ::Rails::VERSION::STRING >= "7.1.0"
1514
expect(group).to respond_to(:fixture_paths)
1615
expect(group).to respond_to(:fixture_paths=)
16+
17+
# These are deprecated when Rails is 7.1.0 but still exist
18+
expect(group).to respond_to(:fixture_path)
19+
expect(group).to respond_to(:fixture_path=)
20+
else
21+
expect(group).to respond_to(:fixture_path)
22+
expect(group).to respond_to(:fixture_path=)
1723
end
1824
end
1925
end

0 commit comments

Comments
 (0)