Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow global configuration with ~/.simplecov #195

Merged
merged 1 commit into from
Feb 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions features/config_styles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions lib/simplecov/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)