-
Notifications
You must be signed in to change notification settings - Fork 577
Expand file tree
/
Copy pathcommand_guesser_spec.rb
More file actions
55 lines (47 loc) · 2.22 KB
/
command_guesser_spec.rb
File metadata and controls
55 lines (47 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# frozen_string_literal: true
require "helper"
describe SimpleCov::CommandGuesser do
subject { SimpleCov::CommandGuesser }
it 'correctly guesses "Unit Tests" for unit tests' do
subject.original_run_command = "/some/path/test/units/foo_bar_test.rb"
expect(subject.guess).to eq("Unit Tests")
subject.original_run_command = "test/units/foo.rb"
expect(subject.guess).to eq("Unit Tests")
subject.original_run_command = "test/foo.rb"
expect(subject.guess).to eq("Unit Tests")
subject.original_run_command = "test/{models,helpers,unit}/**/*_test.rb"
expect(subject.guess).to eq("Unit Tests")
end
it 'correctly guesses "Functional Tests" for functional tests' do
subject.original_run_command = "/some/path/test/functional/foo_bar_controller_test.rb"
expect(subject.guess).to eq("Functional Tests")
subject.original_run_command = "test/{controllers,mailers,functional}/**/*_test.rb"
expect(subject.guess).to eq("Functional Tests")
end
it 'correctly guesses "Integration Tests" for integration tests' do
subject.original_run_command = "/some/path/test/integration/foo_bar_controller_test.rb"
expect(subject.guess).to eq("Integration Tests")
subject.original_run_command = "test/integration/**/*_test.rb"
expect(subject.guess).to eq("Integration Tests")
end
it 'correctly guesses "Cucumber Features" for cucumber features' do
subject.original_run_command = "features"
expect(subject.guess).to eq("Cucumber Features")
subject.original_run_command = "cucumber"
expect(subject.guess).to eq("Cucumber Features")
end
it 'correctly guesses "RSpec" for RSpec' do
subject.original_run_command = "/some/path/spec/foo.rb"
expect(subject.guess).to eq("RSpec")
end
it "defaults to RSpec because RSpec constant is defined" do
subject.original_run_command = "some_arbitrary_command with arguments"
expect(subject.guess).to eq("RSpec")
end
it "appends parallel data" do
subject.original_run_command = "/some/path/spec/foo.rb"
expect(ENV).to receive(:[]).with("TEST_ENV_NUMBER").at_least(:once).and_return("1")
expect(ENV).to receive(:[]).with("PARALLEL_TEST_GROUPS").at_least(:once).and_return("2")
expect(subject.guess).to eq("RSpec (1/2)")
end
end