Skip to content

Commit

Permalink
style(rubocop): Style/MapIntoArray
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Apr 15, 2024
1 parent 1ce2334 commit b7b0833
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions test/xml/node/test_attribute_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ def setup
end

def test_each
attributes = []
@xml.xpath("//address")[1].each do |key, value|
attributes << [key, value]
attributes = @xml.xpath("//address")[1].map do |key, value|
[key, value]
end
assert_equal([["domestic", "Yes"], ["street", "Yes"]], attributes)
end
Expand Down
6 changes: 2 additions & 4 deletions test/xml/test_entity_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ def setup
cfg.dtdload
cfg.noent
end
nodes = []
reader.each { |n| nodes << n.value }
nodes = reader.map(&:value)

assert_equal ["foobar"], nodes.compact.map(&:strip).reject(&:empty?)
end
Expand All @@ -282,8 +281,7 @@ def setup
cfg.default_xml
cfg.dtdload
end
nodes = []
reader.each { |n| nodes << n.value }
nodes = reader.map(&:value)

assert_empty nodes.compact.map(&:strip).reject(&:empty?)
end
Expand Down
5 changes: 2 additions & 3 deletions test/xml/test_unparented_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ def test_keys
end

def test_each
attributes = []
@node.xpath(".//address")[1].each do |key, value|
attributes << [key, value]
attributes = @node.xpath(".//address")[1].map do |key, value|
[key, value]
end
assert_equal([["domestic", "Yes"], ["street", "Yes"]], attributes)
end
Expand Down

0 comments on commit b7b0833

Please sign in to comment.