File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,19 @@ def variants
5151 [ main_variant ] + rest_variants
5252 end
5353
54+ def match_exclusion? ( exclusion )
55+ return false if exclusion . empty?
56+
57+ variants . all? do |variant |
58+ vector_key = variant . vector . key
59+ if exclusion . key? ( vector_key )
60+ exclusion [ vector_key ] == variant . key
61+ else
62+ true
63+ end
64+ end
65+ end
66+
5467 end
5568 end
5669end
Original file line number Diff line number Diff line change @@ -74,6 +74,15 @@ def test_variants
7474 assert_equal "5.0" , @context . variants [ 2 ] . key
7575 end
7676
77+ def test_match_exclusion
78+ assert @context . match_exclusion? ( { "ruby" => "3.0" , "rails" => "6.1" } )
79+ assert @context . match_exclusion? ( { "ruby" => "3.0" , "rails" => "6.1" , "sidekiq" => "5.0" } )
80+ assert @context . match_exclusion? ( { "rails" => "6.1" , "sidekiq" => "5.0" } )
81+ refute @context . match_exclusion? ( { "ruby" => "2.7" , "rails" => "6.1" } )
82+ refute @context . match_exclusion? ( { "sidekiq" => "6.0" } )
83+ refute @context . match_exclusion? ( { } )
84+ end
85+
7786 def test_all
7887 Matrixeval ::Ruby ::Config . stubs ( :variant_combinations ) . returns ( [
7988 [
You can’t perform that action at this time.
0 commit comments