Skip to content

Commit

Permalink
Fix run all when filtered examples
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Oct 9, 2024
1 parent 2279229 commit 447893d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Feature: Using `run_all_when_everything_filtered`
"""
When I run `rspec spec/example_spec.rb --tag some_tag`
Then the output should contain "1 example, 0 failures"
And the output should contain "Run options: include {:some_tag=>true}"
And the output should contain in either hash syntax "Run options: include {:some_tag=>true}"

Scenario: When the `run_all_when_everything_filtered` option is turned on, all the specs are run when the tag has no matches
Given a file named "spec/example_spec.rb" with:
Expand All @@ -78,5 +78,5 @@ Feature: Using `run_all_when_everything_filtered`
"""
When I run `rspec spec/example_spec.rb --tag some_tag`
Then the output should contain "2 examples, 0 failures"
And the output should contain "All examples were filtered out; ignoring {:some_tag=>true}"
And the output should contain in either hash syntax "All examples were filtered out; ignoring {:some_tag=>true}"

8 changes: 8 additions & 0 deletions features/step_definitions/additional_cli_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
end
end

Then /^the output should contain in either hash syntax "(.*)"$/ do |string|
if RUBY_VERSION.to_f > 3.3
step "the output should contain \"#{string.gsub(/:(\w+)=>/, '\1: ')}\""
else
step "the output should contain \"#{string}\""
end
end

Then /^the output should contain all of these:$/ do |table|
table.raw.flatten.each do |string|
expect(all_output).to include(string)
Expand Down

0 comments on commit 447893d

Please sign in to comment.