-
-
Notifications
You must be signed in to change notification settings - Fork 753
Conversation
I'll review in the next day or so. Sent from my iPhone
|
@myronmarston from what I can tell, this is the commit that introduced the split between applying all and applying any: 2a03730. Look familiar? |
There's no reason to keep these separated now that the implementations aren't any different besides the predicate.
That looks vaguely familiar. Funny that it originated with me. I'll dig deeper, thanks. |
OK, so I looked into that commit some more, and I understand why the change was made there -- before then, all filtering had used I think we may consider removing the Anyhow, I also found this: In that commit you changed module inclusion filtering from having I'm thinking that we might be able to re-unify these in 4.0 (particularly if we remove the |
I think we'd want to include any module, hook, etc that matched at least one inclusion filter and no exclusion filters. I can't really remember the motivation for anything different from that. |
I'd be on board with that, although the equivalent is skip now for our usage? We can recommend |
They aren't quite equivalent. I think the equivalent is a simple RSpec.describe "Something that only works on 1.9+", :if => RUBY_VERSION.to_f > 1.8 do
end
# ...becomes:
RSpec.describe "Something that only works on 1.9+" do
end if RUBY_VERSION.to_f > 1.8
# or:
if RUBY_VERSION.to_f > 1.8
RSpec.describe "Something that only works on 1.9+" do
end
end
# or:
RSpec.describe "Something that only works on 1.9+" do
break if RUBY_VERSION.to_f > 1.8
# ...
end Likewise, Anyhow, I've been doing some more thinking about the filtering having RSpec.configure do |c|
# MyModule will only be included in groups with both `:foo => true` AND `:bar => true`
c.include MyModule, :foo => true, :bar => true
end
#...but if you want the `any?` semantic, just call `include` twice:
RSpec.configure do |c|
# MyModule will only be included in groups with either `:foo => true` OR `:bar => true`
c.include MyModule, :foo => true
c.include MyModule, :bar => true
end In effect, you can think of each call to if metadata_filter_hashes.any? do |hash|
if hash.all? { |k, v| applies?(k, v) }
do_it!
end
end If we were to standardize on Thoughts? Anyhow, regarding this PR: in investigating this I've discovered some more missing spec coverage I'm going to add before this is ready to merge. |
OK, I think this is ready to review. |
We were a bit underspecified here.
5132d03
to
11a8f44
Compare
Anyone want to review this? |
LGTM |
Fix all apply
This is a bug in
all_apply?
that I noticed while looking more into the changes I'm making for #1749.I'm still a little confused about why some things use
any_apply?
and some useall_apply?
. Will keep investigating, but I'm hoping perhaps @dchelimsky can remember why sometimes metadata filtering uses one and other times it uses the other?