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

Fix command name detecting for capybara 2.0 #186

Closed
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
12 changes: 12 additions & 0 deletions features/config_command_name.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ Feature: Custom names for individual test suites
| Dreck macht Speck |
| I'm in UR Unitz |

Scenario: RSpec auto detection with spec/features
Given SimpleCov for RSpec is configured with:
"""
require 'simplecov'
SimpleCov.start
"""
And a file named "spec/features/foobar_spec.rb" with:
"""
"""
When I open the coverage report generated with `bundle exec rspec spec`
Then the report should be based upon:
| RSpec |
15 changes: 13 additions & 2 deletions lib/simplecov/command_guesser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,22 @@ class << self
attr_accessor :original_run_command

def guess
from_command_line_options || from_defined_constants
from_program_name || from_command_line_options || from_defined_constants
end

private

def from_program_name
case $PROGRAM_NAME
when /\/rspec$/
"RSpec"
when /\/cucumber$/
"Cucumber Features"
else
nil
end
end

def from_command_line_options
case original_run_command
when /#{'test/functional/'}/, /#{'test/{.*?functional.*?}/'}/
Expand Down Expand Up @@ -46,4 +57,4 @@ def from_defined_constants
end
end
end
end
end