Skip to content

Commit 9e4615a

Browse files
committed
Be more explicit about choosing test projects
With the incoming introduction of more test projects, I believe it's better to explicitly step into them rather than relying on the cucumber annotations to get into one project or the other. Yes it's more code, but less magic and more explicitness. Drive by renamed the parallel tests project, no need to extra call out that it's a project.
1 parent 645763d commit 9e4615a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+108
-30
lines changed

features/branch_coverage.feature

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Feature:
33

44
Simply executing branch coverage gives ok results.
55

6+
Background:
7+
Given I'm working on the project "faked_project"
8+
69
Scenario:
710
Given SimpleCov for RSpec is configured with:
811
"""

features/config_autoload.feature

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Feature:
1111
and then use the same configuration on all test suites simply
1212
by doing a 'require "simplecov"'
1313

14+
Background:
15+
Given I'm working on the project "faked_project"
16+
1417
Scenario:
1518
Given a file named ".simplecov" with:
1619
"""

features/config_command_name.feature

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Feature: Custom names for individual test suites
66
Test/Unit, RSpec and Cucumber, but if that is insufficient, each test suite
77
config can be given a custom command name using SimpleCov.command_name.
88

9+
Background:
10+
Given I'm working on the project "faked_project"
11+
912
Scenario:
1013
Given SimpleCov for Test/Unit is configured with:
1114
"""

features/config_coverage_dir.feature

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Feature:
66
will be put there instead of the default 'coverage' directory
77
in your project's root.
88

9+
Background:
10+
Given I'm working on the project "faked_project"
11+
912
Scenario:
1013
Given SimpleCov for Test/Unit is configured with:
1114
"""

features/config_deactivate_merging.feature

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Feature:
88
It's probably preferrable to generate the individual suite results into separate
99
output directories instead (see SimpleCov.coverage_dir), but it is possible :)
1010

11+
Background:
12+
Given I'm working on the project "faked_project"
13+
1114
Scenario:
1215
Given SimpleCov for Test/Unit is configured with:
1316
"""
@@ -39,4 +42,3 @@ Feature:
3942
Given I open the coverage report
4043
Then the report should be based upon:
4144
| RSpec |
42-

features/config_formatters.feature

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Feature:
1010
SimpleCov::Formatter::MultiFormatter is a formatter
1111
used to call multiple formatters at once.
1212

13+
Background:
14+
Given I'm working on the project "faked_project"
15+
1316
Scenario: With SimpleFormatter
1417
Given SimpleCov for Test/Unit is configured with:
1518
"""

features/config_merge_timeout.feature

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Feature:
1212
are out of date when the second suite finishes and thus does not end up
1313
in the report.
1414

15+
Background:
16+
Given I'm working on the project "faked_project"
17+
1518
Scenario:
1619
Given SimpleCov for Test/Unit is configured with:
1720
"""
@@ -36,4 +39,3 @@ Feature:
3639
And I open the coverage report generated with `bundle exec rspec spec`
3740
Then the report should be based upon:
3841
| RSpec |
39-

features/config_nocov_token.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Code wrapped in # :nocov: will be ignored by coverage reports.
55
The name of the token can be configured with SimpleCov.nocov_token or SimpleCov.skip_token
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario: Custom nocov token using nocov_token
811
Given SimpleCov for Test/Unit is configured with:
912
"""

features/config_profiles.feature

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Feature:
66
that can be loaded at once.
77

88
Background:
9-
Given SimpleCov for Test/Unit is configured with:
9+
Given I'm working on the project "faked_project"
10+
And SimpleCov for Test/Unit is configured with:
1011
"""
1112
require 'simplecov'
1213
"""

features/config_project_name.feature

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Feature:
55
If this is not sufficient for you, you can specify a custom name using
66
SimpleCov.project_name('xyz')
77

8+
Background:
9+
Given I'm working on the project "faked_project"
810

911
Scenario: Guessed name
1012
Given SimpleCov for Test/Unit is configured with:

features/config_styles.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature:
66
preference or project requirements.
77

88
Background:
9+
Given I'm working on the project "faked_project"
910
Given SimpleCov for Test/Unit is configured with:
1011
"""
1112
require 'simplecov'
@@ -118,4 +119,3 @@ Feature:
118119
When I open the coverage report generated with `bundle exec rake test`
119120
Then I should see "4 files in total."
120121
And I should see "using Config Test Runner" within "#footer"
121-

features/config_tracked_files.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Using the setting `tracked_files` should add files that were not
55
required to the report.
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for Test/Unit is configured with:
912
"""

features/config_tracked_files_relevant_lines.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Using the setting `tracked_files` should classify whether lines
55
are relevant or not (such as whitespace or comments).
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for RSpec is configured with:
912
"""

features/cucumber_basic.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Simply adding the basic simplecov lines to a project should get
55
the user a coverage report after running `cucumber features`
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for Cucumber is configured with:
912
"""

features/maximum_coverage_drop.feature

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Exit code should be non-zero if the overall coverage decreases by more than
55
the maximum_coverage_drop threshold.
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario: maximum_coverage_drop configured cam cause spec failure
811
Given SimpleCov for Test/Unit is configured with:
912
"""
@@ -136,4 +139,3 @@ Feature:
136139
}
137140
}
138141
"""
139-

features/merging_test_unit_and_rspec.feature

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Feature:
55
when both have been run recently. The coverage report will feature
66
the joined results of all test suites that are using SimpleCov.
77

8+
Background:
9+
Given I'm working on the project "faked_project"
10+
811
Scenario:
912
Given SimpleCov for Test/Unit is configured with:
1013
"""

features/minimum_coverage.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Exit code should be non-zero if the overall coverage is below the
55
minimum_coverage threshold.
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for Test/Unit is configured with:
912
"""

features/old_version_json.feature

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
@rspec @old_coverage_json
1+
@rspec
22

33
Feature:
44

55
This test project has a resultset.json generated by simplecov 0.17.1 lying around
66
(we changed the file format in 0.18) - as long as we want a hassle free upgrade
77
path from 0.17 and below to our current version this cuke should pass :) #820
88

9+
Background:
10+
Given I'm working on the project "old_coverage_json"
11+
912
Scenario: Running the tests succeeds
1013
Given the paths in the old .resultset.json are adjusted to the current environment
1114
When I open the coverage report generated with `bundle exec rspec spec`

features/parallel_tests.feature

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
@parallel_tests_project @rspec
2-
@disable-bundler
1+
@rspec @disable-bundler
32

43
Feature:
54

65
Parallel tests and its corresponding test project work together with Simplecov
76
just fine and they produce the same output like a normal rspec run.
87

8+
Background:
9+
Given I'm working on the project "parallel_tests"
10+
911
# see #815
1012
@wip
1113
Scenario: Running it through parallel_tests produces the same results as a normal rspec run

features/refuse_coverage_drop.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Exit code should be non-zero if the overall coverage decreases.
55
And last_run file should not be overwritten with new coverage value.
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario: refuse_coverage_drop configured
811
Given SimpleCov for Test/Unit is configured with:
912
"""

features/rspec_basic.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Simply adding the basic simplecov lines to a project should get
55
the user a coverage report after running `rspec`
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for RSpec is configured with:
912
"""

features/rspec_fails_on_initialization.feature

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Feature:
33

44
Running specs with a failing rspec setup
55

6+
Background:
7+
Given I'm working on the project "faked_project"
8+
69
Scenario: Fail if rspec fails before starting its tests
710
Given a file named "spec/spec_helper.rb" with:
811
"""

features/rspec_groups_and_filters_basic.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Defining some groups and filters should give a corresponding
55
coverage report that respects those settings after running rspec
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for RSpec is configured with:
912
"""

features/rspec_groups_and_filters_complex.feature

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Feature: Sophisticated grouping and filtering on RSpec
66
and potentially weird conditions to remove files from the report or add them
77
to specific groups.
88

9+
Background:
10+
Given I'm working on the project "faked_project"
11+
912
Scenario:
1013
Given SimpleCov for RSpec is configured with:
1114
"""

features/rspec_groups_using_filter_class.feature

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Feature: Grouping on RSpec using a custom filter class
66
must implement the matches? method, which is used to determine whether
77
or not a file should be added to the group.
88

9+
Background:
10+
Given I'm working on the project "faked_project"
11+
912
Scenario:
1013
Given SimpleCov for RSpec is configured with:
1114
"""

features/rspec_without_simplecov.feature

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Feature:
33

44
Running specs without simplecov configuration
55

6+
Background:
7+
Given I'm working on the project "faked_project"
8+
69
Scenario: No config at all
710
When I successfully run `bundle exec rspec spec`
811
Then no coverage report should have been generated

features/skipping_code_blocks_manually.feature

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Feature:
55
against the coverage numbers.
66

77
Background:
8+
Given I'm working on the project "faked_project"
89
Given SimpleCov for Test/Unit is configured with:
910
"""
1011
require 'simplecov'

features/step_definitions/simplecov_steps.rb

+12
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,15 @@
8585
binding.pry
8686
# rubocop:enable Lint/Debugger
8787
end
88+
89+
Given "I'm working on the project {string}" do |project_name|
90+
this_dir = File.dirname(__FILE__)
91+
92+
# Clean up and create blank state for project
93+
cd(".") do
94+
FileUtils.rm_rf "project"
95+
FileUtils.cp_r File.join(this_dir, "../../test_projects/#{project_name}/"), "project"
96+
end
97+
98+
step 'I cd to "project"'
99+
end

features/support/env.rb

-22
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,6 @@
4646
skip_this_scenario unless SimpleCov.branch_coverage_supported?
4747
end
4848

49-
Before("@parallel_tests_project") do
50-
@test_project_name = "parallel_tests_project"
51-
end
52-
53-
Before("@old_coverage_json") do
54-
@test_project_name = "old_coverage_json"
55-
end
56-
57-
Before do
58-
this_dir = File.dirname(__FILE__)
59-
60-
@test_project_name ||= "faked_project"
61-
62-
# Clean up and create blank state for fake project
63-
cd(".") do
64-
FileUtils.rm_rf "project"
65-
FileUtils.cp_r File.join(this_dir, "../../test_projects/#{@test_project_name}/"), "project"
66-
end
67-
68-
step 'I cd to "project"'
69-
end
70-
7149
Aruba.configure do |config|
7250
config.allow_absolute_paths = true
7351

features/test_unit_basic.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Simply adding the basic simplecov lines to a project should get
55
the user a coverage report after running `rake test`
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for Test/Unit is configured with:
912
"""

features/test_unit_collate.feature

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Feature:
33

44
Using SimpleCov.collate should get the user a coverage report
55

6+
Background:
7+
Given I'm working on the project "faked_project"
8+
69
Scenario:
710
Given SimpleCov for Test/Unit is configured with:
811
"""

features/test_unit_groups_and_filters_basic.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Feature:
44
Defining some groups and filters should give a corresponding
55
coverage report that respects those settings after running tests
66

7+
Background:
8+
Given I'm working on the project "faked_project"
9+
710
Scenario:
811
Given SimpleCov for Test/Unit is configured with:
912
"""

features/test_unit_groups_and_filters_complex.feature

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Feature: Sophisticated grouping and filtering on Test/Unit
66
and potentially weird conditions to remove files from the report or add them
77
to specific groups.
88

9+
Background:
10+
Given I'm working on the project "faked_project"
11+
912
Scenario:
1013
Given SimpleCov for Test/Unit is configured with:
1114
"""

features/test_unit_groups_using_filter_class.feature

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Feature: Grouping on Test/Unit using a custom filter class
66
must implement the matches? method, which is used to determine whether
77
or not a file should be added to the group.
88

9+
Background:
10+
Given I'm working on the project "faked_project"
11+
912
Scenario:
1013
Given SimpleCov for Test/Unit is configured with:
1114
"""

0 commit comments

Comments
 (0)