Skip to content

Commit

Permalink
trap annoying warning output from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Oct 18, 2023
1 parent 11ab0fe commit 883a92d
Showing 1 changed file with 44 additions and 36 deletions.
80 changes: 44 additions & 36 deletions test/standard/plugin/merges_plugins_into_rubocop_config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ def test_accepts_both_object_and_path_plugins_and_first_in_wins_without_merge
"AllCops" => {}
}, "")

@subject.call(options_config, {}, [
PathyPlugin.new("test/fixture/plugins/rules.yml"),
ObjectyPlugin.new("Fake/Things" => {"Enabled" => true, "Dingus" => "never", "Really" => false}, "Fake/Junk" => {"Enabled" => false}),
ObjectyPlugin.new("Fake/Crap" => {"Enabled" => true})
], permit_merging: true)
capture_io do
@subject.call(options_config, {}, [
PathyPlugin.new("test/fixture/plugins/rules.yml"),
ObjectyPlugin.new("Fake/Things" => {"Enabled" => true, "Dingus" => "never", "Really" => false}, "Fake/Junk" => {"Enabled" => false}),
ObjectyPlugin.new("Fake/Crap" => {"Enabled" => true})
], permit_merging: true)
end

assert_equal({
"AllCops" => {},
Expand Down Expand Up @@ -135,24 +137,26 @@ def test_that_first_person_to_set_a_rule_cant_have_the_nested_attributes_overrid
}
}, "")

@subject.call(options_config, {}, [
ObjectyPlugin.new(
"Breakfast/Eggs" => {
"Enabled" => true,
"EnforcedStyle" => "scrambled"
}
),
ObjectyPlugin.new(
"Breakfast/Eggs" => {
"EnforcedStyle" => "poached"
}
),
ObjectyPlugin.new(
"Breakfast/Eggs" => {
"Salt" => true
}
)
], permit_merging: true)
capture_io do
@subject.call(options_config, {}, [
ObjectyPlugin.new(
"Breakfast/Eggs" => {
"Enabled" => true,
"EnforcedStyle" => "scrambled"
}
),
ObjectyPlugin.new(
"Breakfast/Eggs" => {
"EnforcedStyle" => "poached"
}
),
ObjectyPlugin.new(
"Breakfast/Eggs" => {
"Salt" => true
}
)
], permit_merging: true)
end

assert_equal({
"AllCops" => {},
Expand All @@ -171,11 +175,13 @@ def test_that_first_person_to_set_an_allcop_setting_wins_it_but_not_disallowed_o
}
}, "")

@subject.call(options_config, {}, [
ObjectyPlugin.new("AllCops" => {"A" => "a1", "B" => "b1", "C" => "c1"}),
ObjectyPlugin.new("AllCops" => {"A" => "a2", "B" => "b2", "C" => "c2", "D" => "d2"}),
ObjectyPlugin.new("AllCops" => {"E" => "e3"})
], permit_merging: true)
capture_io do
@subject.call(options_config, {}, [
ObjectyPlugin.new("AllCops" => {"A" => "a1", "B" => "b1", "C" => "c1"}),
ObjectyPlugin.new("AllCops" => {"A" => "a2", "B" => "b2", "C" => "c2", "D" => "d2"}),
ObjectyPlugin.new("AllCops" => {"E" => "e3"})
], permit_merging: true)
end

assert_equal({
"AllCops" => {"A" => "a1", "B" => "b1", "C" => "c1", "D" => "d2", "E" => "e3"}
Expand All @@ -199,14 +205,16 @@ def test_that_all_cops_arrays_are_concated_but_rule_arrays_are_overwritten
}
}, "")

@subject.call(options_config, {}, [
ObjectyPlugin.new("AllCops" => {"fruits" => ["banana"]}),
ObjectyPlugin.new("AllCops" => {"nuts" => []}),
ObjectyPlugin.new("AllCops" => {"fruits" => []}, "Some/Rule" => {"candies" => ["lollipop"]}),
ObjectyPlugin.new("AllCops" => {"fruits" => ["tomato", "orange"]}),
ObjectyPlugin.new("AllCops" => {"nuts" => ["cashew"]}, "Some/Rule" => {"candies" => ["suckers", "gum"]}),
ObjectyPlugin.new("AllCops" => {"nuts" => ["peanut", "cashew"]})
], permit_merging: true)
capture_io do
@subject.call(options_config, {}, [
ObjectyPlugin.new("AllCops" => {"fruits" => ["banana"]}),
ObjectyPlugin.new("AllCops" => {"nuts" => []}),
ObjectyPlugin.new("AllCops" => {"fruits" => []}, "Some/Rule" => {"candies" => ["lollipop"]}),
ObjectyPlugin.new("AllCops" => {"fruits" => ["tomato", "orange"]}),
ObjectyPlugin.new("AllCops" => {"nuts" => ["cashew"]}, "Some/Rule" => {"candies" => ["suckers", "gum"]}),
ObjectyPlugin.new("AllCops" => {"nuts" => ["peanut", "cashew"]})
], permit_merging: true)
end

assert_equal({
"AllCops" => {
Expand Down

0 comments on commit 883a92d

Please sign in to comment.