If any part of the metadata matches an exclusion it will not be run:
RSpec.configure do |config|
config.filter_run_excluding :meta_a, meta_b: true, meta_c: :value
config.filter_run_including meta_a: true
end
RSpec.describe "working with metadata" do
it "excludes fully matching metadata (:meta, meta_b: true, meta_c: :value)",
:meta_a, meta_b: true, meta_c: :value do
raise "This should not run!"
end
it "excludes partially matching metadata (:meta)", meta_a: true do
raise "This should not run!"
end
it "excludes partially matching metadata (meta_b: true)", :meta_b do
raise "This should not run!"
end
it "excludes partially matching metadata (meta_c: :value)", meta_c: :value do
raise "This should not run!"
end
it "excludes partially matching metadata (:other, :meta_a)",
:other, :meta_a do
expect(:run).to be :run
end
it "runs fully non-matching metadata values (meta_a: false)", meta_a: false do
expect(:run).to be :run
end
it "runs fully non-matching metadata values (meta_c: :other)", meta_c: :other do
expect(:run).to be :run
end
it "runs other metadata", other: true do
expect(:run).to be :run
end
end
# =>
# Run options:
# include {:focus=>true}
# exclude {:meta_b=>true, :meta_c=>:value, :meta_a=>true, :ruby=>#<Proc:./spec/spec_helper.rb:106>}
#
# All examples were filtered out; ignoring {:focus=>true}
#
# Randomized with seed 56839
#
# working with metadata
# runs other metadata
# runs fully non-matching metadata values (meta_c: :other)
# runs fully non-matching metadata values (meta_a: false)
#
# Finished in 0.0037 seconds (files took 0.26485 seconds to load)
# 3 examples, 0 failures
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/6a3b0b0b-6adb-4e09-b91a-2eba408fcaea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.