|
5 | 5 | describe SimpleCov::CommandGuesser do
|
6 | 6 | subject { SimpleCov::CommandGuesser }
|
7 | 7 | 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" } |
9 | 9 | 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" } |
11 | 11 | 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" } |
13 | 13 | 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" } |
15 | 15 | expect(subject.guess).to eq("Unit Tests")
|
16 | 16 | end
|
17 | 17 |
|
18 | 18 | 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" } |
20 | 20 | 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" } |
22 | 22 | expect(subject.guess).to eq("Functional Tests")
|
23 | 23 | end
|
24 | 24 |
|
25 | 25 | 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" } |
27 | 27 | 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" } |
29 | 29 | expect(subject.guess).to eq("Integration Tests")
|
30 | 30 | end
|
31 | 31 |
|
32 | 32 | it 'correctly guesses "Cucumber Features" for cucumber features' do
|
33 |
| - subject.original_run_command = "features" |
| 33 | + allow(subject).to receive(:original_run_command) { "features" } |
34 | 34 | expect(subject.guess).to eq("Cucumber Features")
|
35 |
| - subject.original_run_command = "cucumber" |
| 35 | + allow(subject).to receive(:original_run_command) { "cucumber" } |
36 | 36 | expect(subject.guess).to eq("Cucumber Features")
|
37 | 37 | end
|
38 | 38 |
|
39 | 39 | 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" } |
41 | 41 | expect(subject.guess).to eq("RSpec")
|
42 | 42 | end
|
43 | 43 |
|
44 | 44 | 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" } |
46 | 46 | expect(subject.guess).to eq("RSpec")
|
47 | 47 | end
|
48 | 48 | end
|
0 commit comments