Skip to content

Commit 4904192

Browse files
committed
fix flacky specs
1 parent d79cb80 commit 4904192

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

spec/command_guesser_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,44 @@
55
describe SimpleCov::CommandGuesser do
66
subject { SimpleCov::CommandGuesser }
77
it 'correctly guesses "Unit Tests" for unit tests' do
8-
subject.original_run_command = "/some/path/test/units/foo_bar_test.rb"
8+
allow(subject).to receive(:original_run_command) { "/some/path/test/units/foo_bar_test.rb" }
99
expect(subject.guess).to eq("Unit Tests")
10-
subject.original_run_command = "test/units/foo.rb"
10+
allow(subject).to receive(:original_run_command) { "test/units/foo.rb" }
1111
expect(subject.guess).to eq("Unit Tests")
12-
subject.original_run_command = "test/foo.rb"
12+
allow(subject).to receive(:original_run_command) { "test/foo.rb" }
1313
expect(subject.guess).to eq("Unit Tests")
14-
subject.original_run_command = "test/{models,helpers,unit}/**/*_test.rb"
14+
allow(subject).to receive(:original_run_command) { "test/{models,helpers,unit}/**/*_test.rb" }
1515
expect(subject.guess).to eq("Unit Tests")
1616
end
1717

1818
it 'correctly guesses "Functional Tests" for functional tests' do
19-
subject.original_run_command = "/some/path/test/functional/foo_bar_controller_test.rb"
19+
allow(subject).to receive(:original_run_command) { "/some/path/test/functional/foo_bar_controller_test.rb" }
2020
expect(subject.guess).to eq("Functional Tests")
21-
subject.original_run_command = "test/{controllers,mailers,functional}/**/*_test.rb"
21+
allow(subject).to receive(:original_run_command) { "test/{controllers,mailers,functional}/**/*_test.rb" }
2222
expect(subject.guess).to eq("Functional Tests")
2323
end
2424

2525
it 'correctly guesses "Integration Tests" for integration tests' do
26-
subject.original_run_command = "/some/path/test/integration/foo_bar_controller_test.rb"
26+
allow(subject).to receive(:original_run_command) { "/some/path/test/integration/foo_bar_controller_test.rb" }
2727
expect(subject.guess).to eq("Integration Tests")
28-
subject.original_run_command = "test/integration/**/*_test.rb"
28+
allow(subject).to receive(:original_run_command) { "test/integration/**/*_test.rb" }
2929
expect(subject.guess).to eq("Integration Tests")
3030
end
3131

3232
it 'correctly guesses "Cucumber Features" for cucumber features' do
33-
subject.original_run_command = "features"
33+
allow(subject).to receive(:original_run_command) { "features" }
3434
expect(subject.guess).to eq("Cucumber Features")
35-
subject.original_run_command = "cucumber"
35+
allow(subject).to receive(:original_run_command) { "cucumber" }
3636
expect(subject.guess).to eq("Cucumber Features")
3737
end
3838

3939
it 'correctly guesses "RSpec" for RSpec' do
40-
subject.original_run_command = "/some/path/spec/foo.rb"
40+
allow(subject).to receive(:original_run_command) { "/some/path/spec/foo.rb" }
4141
expect(subject.guess).to eq("RSpec")
4242
end
4343

4444
it "defaults to RSpec because RSpec constant is defined" do
45-
subject.original_run_command = "some_arbitrary_command with arguments"
45+
allow(subject).to receive(:original_run_command) { "some_arbitrary_command with arguments" }
4646
expect(subject.guess).to eq("RSpec")
4747
end
4848
end

0 commit comments

Comments
 (0)