Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit d229dd2

Browse files
committed
Stop stubbing the object under test.
It made more sense when these methods were on `world` as they were before but now they are on config so we want to avoid that.
1 parent 226d48a commit d229dd2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

spec/rspec/core/configuration/only_failures_support_spec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def simulate_persisted_examples(*examples)
66
config.example_status_persistence_file_path = "examples.txt"
77
persister = class_double(ExampleStatusPersister).as_stubbed_const
88

9-
allow(persister).to receive(:load_from).with("examples.txt").and_return(examples)
9+
allow(persister).to receive(:load_from).with("examples.txt").and_return(examples.flatten)
1010
end
1111

1212
describe "#last_run_statuses" do
@@ -145,7 +145,11 @@ def allows_value_to_change_when_updated
145145
before do
146146
expect(files_loaded_via_default_path).not_to eq(files_with_failures)
147147
config.default_path = default_path
148-
allow(config).to receive_messages(:spec_files_with_failures => files_with_failures)
148+
149+
simulate_persisted_examples(files_with_failures.map do |file|
150+
{ :example_id => "#{file}[1:1]", :status => "failed" }
151+
end)
152+
149153
config.force(:only_failures => true)
150154
end
151155

@@ -156,7 +160,7 @@ def allows_value_to_change_when_updated
156160
end
157161

158162
it 'loads the default path if there are no files with failures' do
159-
allow(config).to receive_messages(:spec_files_with_failures => [])
163+
simulate_persisted_examples([])
160164
config.files_or_directories_to_run = []
161165
expect(config.files_to_run).to eq(files_loaded_via_default_path)
162166
end

0 commit comments

Comments
 (0)