-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
run_all_when_everything_filtered
with filter_run_excluding
doesn't run test file
#2530
Comments
filter_all_when_everything_excluded
with filter_run_excluding
doesn't run test filerun_all_when_everything_excluded
with filter_run_excluding
doesn't run test file
run_all_when_everything_excluded
with filter_run_excluding
doesn't run test filerun_all_when_everything_filtered
with filter_run_excluding
doesn't run test file
In the meantime, there's a better/simpler way to do this using a combination of RSpec.configure do |config|
config.define_derived_metadata do |meta|
meta[:integration] = false unless meta.key?(:integration)
end
config.filter_run_when_matching integration: false
end Here's what this does:
I think that'll do what you want. |
Thanks for the explanation. Your suggestion works for a single tag, but I think when you pass multiple tags to I made a gist to reproduce: https://gist.github.com/alexgenco/494cbbfb1fcea4154150a5b8b325c9aa If you just run |
It's not clear to me what behavior you're trying to achieve (e.g. are you trying to AND the tags together or OR them?) but regardless, you can achieve it by doing a bit more in your RSpec.configure do |config|
RSpec.configure do |config|
config.define_derived_metadata do |meta|
meta[:integration] = false unless meta.key?(:integration)
meta[:other_tag] = false unless meta.key?(:other_tag)
meta[:integration_other_tag] = meta[:integration] && meta[:other_tag]
# or meta[:integration_other_tag] = meta[:integration] || meta[:other_tag]
end
config.filter_run_when_matching integration_other_tag: false
end
end |
Thanks, this works! To be clear, this was the final fix: config.define_derived_metadata do |meta|
meta[:filtered] = FILTERED_TAGS.any? { |tag| meta[tag] }
end
config.filter_run_when_matching :filtered => false where |
If I configure RSpec with both of these options e.g.
And then I have a spec file with
:integration
metadata:When I run the file using
rspec path/to/file_spec.rb
, it outputs the following:The
ignoring {}
is suspect to me, as I would expect it to sayignoring {:other_tag=>true, :integration=>true}
, and then run the entire file.We are using rspec-core 3.6.0, and I see that this use case is deprecated, however I can't figure out how to make this scenario work with
filter_run_when_matching
. We essentially want to ignore these tests when running the full test suite, but support running the file alone without specifying the filters explicitly with-t integration
.The text was updated successfully, but these errors were encountered: