-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In converting this to a regex in a0b14a1, an extra leading `/` was added, making this filter less useful (it would literally match the `/^/db/` path).
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require "helper" | ||
|
||
if SimpleCov.usable? | ||
describe SimpleCov do | ||
skip "requires the default configuration" if ENV["SIMPLECOV_NO_DEFAULTS"] | ||
|
||
context "profiles" do | ||
let(:config_class) do | ||
Class.new do | ||
include SimpleCov::Configuration | ||
|
||
def load_profile(name) | ||
configure(&SimpleCov.profiles[name.to_sym]) | ||
end | ||
end | ||
end | ||
|
||
let(:config) { config_class.new } | ||
|
||
def filtered?(config, filename) | ||
path = File.join(SimpleCov.root, filename) | ||
file = SimpleCov::SourceFile.new(path, [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil]) | ||
config.filters.any? { |filter| filter.matches?(file) } | ||
end | ||
|
||
it "provides a sensible test_frameworks profile" do | ||
config.load_profile(:test_frameworks) | ||
expect(filtered?(config, "foo.rb")).not_to be | ||
expect(filtered?(config, "test/foo.rb")).to be | ||
expect(filtered?(config, "spec/bar.rb")).to be | ||
end | ||
|
||
it "provides a sensible rails profile" do | ||
config.load_profile(:rails) | ||
expect(filtered?(config, "app/models/user.rb")).not_to be | ||
expect(filtered?(config, "db/schema.rb")).to be | ||
expect(filtered?(config, "config/environment.rb")).to be | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters