Skip to content

Commit

Permalink
Merge pull request #195 from spagalloco/user-global-configuration
Browse files Browse the repository at this point in the history
allow global configuration with ~/.simplecov
  • Loading branch information
colszowka committed Feb 12, 2013
2 parents 73c6a6c + 7e7797a commit 1def2a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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)

0 comments on commit 1def2a5

Please sign in to comment.