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
|
# 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
end
|