Skip to content

Commit 7c9d9e1

Browse files
committed
expected should be the first argument on assertions
1 parent 60b791e commit 7c9d9e1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/test_address_extractor.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def test_first_address_extraction
77
each_test_data do |test_data|
88
address = AddressExtractor.first_address(test_data[:input])
99
flunk "No address found in:\n#{test_data[:input]}" if address.nil?
10-
assert_equal_hashes address, test_data[:expected_output].first
10+
assert_equal_hashes test_data[:expected_output].first, address
1111
end
1212
end
1313

@@ -16,14 +16,14 @@ def test_find_addresses
1616
addresses = AddressExtractor.find_addresses(test_data[:input])
1717
assert_equal addresses.size, test_data[:expected_output].size
1818
test_data[:expected_output].each do |expected_output|
19-
assert_equal_hashes addresses.shift, expected_output
19+
assert_equal_hashes expected_output, addresses.shift
2020
end
2121
end
2222
end
2323

2424
def test_replace_first_address
2525
string = AddressExtractor.replace_first_address(test_data.first[:input]) do |address_hash, address|
26-
assert_equal_hashes address_hash, test_data.first[:expected_output].first
26+
assert_equal_hashes test_data.first[:expected_output].first, address_hash
2727
assert_match /^\s*123 Foo St., Someplace FL\s*/, address
2828
"skidoosh"
2929
end

test/test_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def test_data
1717
end
1818

1919
module Helpers
20-
def assert_equal_hashes(a,b)
21-
(a.keys + b.keys).uniq.each do |k|
22-
assert_equal a[k], b[k], "a[#{k.inspect}] = #{a[k].inspect} != b[#{k.inspect}] = #{b[k].inspect}"
20+
def assert_equal_hashes(expected, hash)
21+
(expected.keys + hash.keys).uniq.each do |k|
22+
assert_equal expected[k], hash[k], "expected[#{k.inspect}] = #{expected[k].inspect} != hash[#{k.inspect}] = #{hash[k].inspect}"
2323
end
2424
end
2525
end

0 commit comments

Comments
 (0)