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

Commit a8aae27

Browse files
authored
Merge pull request #2532 from garybernhardt/dont_write_status_file_during_dry_runs
Don't write status file during dry runs.
2 parents 5ec33d6 + 5ef72a4 commit a8aae27

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/rspec/core/runner.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def self.handle_interrupt
184184
private
185185

186186
def persist_example_statuses
187+
return if @configuration.dry_run
187188
return unless (path = @configuration.example_status_persistence_file_path)
188189

189190
ExampleStatusPersister.persist(@world.all_examples, path)

spec/rspec/core/runner_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,15 @@ def run
406406
end
407407
end
408408

409+
context "with --dry-run" do
410+
it "doesn't persist example status" do
411+
config.example_status_persistence_file_path = "examples.txt"
412+
config.dry_run = true
413+
run
414+
expect(ExampleStatusPersister).not_to have_received(:persist)
415+
end
416+
end
417+
409418
context "when `example_status_persistence_file_path` is not configured" do
410419
it "doesn't persist example status" do
411420
config.example_status_persistence_file_path = nil

0 commit comments

Comments
 (0)