diff --git a/features/config_styles.feature b/features/config_styles.feature index 17da3de0..c34a44dd 100644 --- a/features/config_styles.feature +++ b/features/config_styles.feature @@ -91,3 +91,19 @@ Feature: Then I should see "4 files in total." And I should see "using Config Test Runner" within "#footer" + Scenario: Global config and local config + Given a file named "~/.simplecov" with: + """ + SimpleCov.configure do + add_filter 'test' + end + """ + And a file named ".simplecov" with: + """ + 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" diff --git a/lib/simplecov/defaults.rb b/lib/simplecov/defaults.rb index 3ad9b34c..efcc9ed4 100644 --- a/lib/simplecov/defaults.rb +++ b/lib/simplecov/defaults.rb @@ -82,5 +82,8 @@ end # Autoload config from .simplecov if present +global_config_path = File.join(File.expand_path("~"), '.simplecov') +load global_config_path if File.exist?(global_config_path) + config_path = File.join(SimpleCov.root, '.simplecov') load config_path if File.exist?(config_path)