Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Fix taging feature on Ruby head
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Oct 9, 2024
1 parent 3f10b72 commit 1f5b045
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
34 changes: 12 additions & 22 deletions features/command_line/tag.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,66 +39,56 @@ Feature: `--tag` option

Scenario: Filter examples with a simple tag
When I run `rspec . --tag focus`
Then the output should contain "include {:focus=>true}"
Then the output should print the included tags {focus: true}
And the examples should all pass

Scenario: Filter examples with a simple tag and @
When I run `rspec . --tag @focus`
Then the output should contain "include {:focus=>true}"
Then the output should print the included tags {focus: true}
Then the examples should all pass

Scenario: Filter examples with a `name:value` tag
When I run `rspec . --tag type:special`
Then the output should contain:
"""
include {:type=>"special"}
"""
Then the output should print the included tags {type: "special"}
And the output should contain "2 examples"
And the examples should all pass

Scenario: Filter examples with a `name:value` tag and @
When I run `rspec . --tag @type:special`
Then the output should contain:
"""
include {:type=>"special"}
"""
Then the output should print the included tags {type: "special"}
And the examples should all pass

Scenario: Exclude examples with a simple tag
When I run `rspec . --tag ~skip`
Then the output should contain "exclude {:skip=>true}"
Then the output should print the excluded tags {skip: true}
Then the examples should all pass

Scenario: Exclude examples with a simple tag and @
When I run `rspec . --tag ~@skip`
Then the output should contain "exclude {:skip=>true}"
Then the output should print the excluded tags {skip: true}
Then the examples should all pass

Scenario: Exclude examples with a `name:value` tag
When I run `rspec . --tag ~speed:slow`
Then the output should contain:
"""
exclude {:speed=>"slow"}
"""
Then the output should print the excluded tags {speed: "slow"}
Then the examples should all pass

Scenario: Exclude examples with a `name:value` tag and @
When I run `rspec . --tag ~@speed:slow`
Then the output should contain:
"""
exclude {:speed=>"slow"}
"""
Then the output should print the excluded tags {speed: "slow"}
Then the examples should all pass

Scenario: Filter examples with a simple tag, exclude examples with another tag
When I run `rspec . --tag focus --tag ~skip`
Then the output should contain "include {:focus=>true}"
And the output should contain "exclude {:skip=>true}"
Then the output should print the included tags {focus: true}
And the output should print the excluded tags {skip: true}
And the examples should all pass

Scenario: Exclude examples with multiple tags
When I run `rspec . --tag ~skip --tag ~speed:slow`
Then the output should contain one of the following:
| exclude {:skip=>true, :speed=>"slow"} |
| exclude {:speed=>"slow", :skip=>true} |
| exclude {skip: true, speed: "slow"} |
| exclude {speed: "slow", skip: true} |
Then the examples should all pass
17 changes: 17 additions & 0 deletions features/step_definitions/additional_cli_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

require './spec/support/formatter_support'

# For Ruby 3.4.0 hash formatting
Then /^the output should print the included tags {(\w+): (\w+)$/ do |key, value|
if RUBY_VERSION.to_f > 3.3
Then %Q{the output should contain "include {#{key}: #{value}}"}
else
Then %Q{the output should contain "include {:#{key}=>#{value}}"}
end
end

Then /^the output should print the excluded tags {(\w+): (\w+)$/ do |key, value|
if RUBY_VERSION.to_f > 3.3
Then %Q{the output should contain "exclude {#{key}: #{value}}"}
else
Then %Q{the output should contain "exclude {:#{key}=>#{value}}"}
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 1f5b045

Please sign in to comment.