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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
@test_unit @config
Feature:
There's several ways to configure SimpleCov. All of those
config schemes below are equivalent and can be chosen by personal
preference or project requirements.
Background:
Given I'm working on the project "faked_project"
Given SimpleCov for Test/Unit is configured with:
"""
require 'simplecov'
"""
Scenario: Inside start block
Given a file named ".simplecov" with:
"""
SimpleCov.start do
add_filter 'test'
command_name 'Config Test Runner'
end
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
Scenario: Inside start block, using instance var from outside
Given a file named ".simplecov" with:
"""
@filter = 'test'
SimpleCov.start do
add_filter @filter
command_name 'Config Test Runner'
end
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
Scenario: Inside start block, using local var from outside
Given a file named ".simplecov" with:
"""
filter = 'test'
SimpleCov.start do
add_filter filter
command_name 'Config Test Runner'
end
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
Scenario: Explicitly before start block
Given a file named ".simplecov" with:
"""
SimpleCov.add_filter 'test'
SimpleCov.command_name 'Config Test Runner'
SimpleCov.start
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
Scenario: Explicitly after start block
Given a file named ".simplecov" with:
"""
SimpleCov.start
SimpleCov.add_filter 'test'
SimpleCov.command_name 'Config Test Runner'
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
Scenario: Using configure block after start
Given a file named ".simplecov" with:
"""
SimpleCov.start
SimpleCov.configure do
add_filter 'test'
command_name 'Config Test Runner'
end
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
Scenario: Using configure block before start
Given a file named ".simplecov" with:
"""
SimpleCov.configure do
add_filter 'test'
command_name 'Config Test Runner'
end
SimpleCov.start
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
Scenario: Mixing configure and start block config
Given a file named ".simplecov" with:
"""
SimpleCov.configure do
command_name 'Config Test Runner'
end
SimpleCov.start do
add_filter 'test'
end
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see "4 files in total."
And I should see "using Config Test Runner" within "#footer"
|