Skip to content

Commit

Permalink
Get rid of hardwired counts in assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Dec 18, 2016
1 parent 970e1a9 commit 0da97d2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions test/models/node_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def test_node_tags
node = current_nodes(:node_with_versions)
taglist = create_list(:node_tag, 2, :node => node)
tags = Node.find(node.id).node_tags.order(:k)
assert_equal 2, tags.count
assert_equal taglist.count, tags.count
taglist.sort_by!(&:k).each_index do |i|
assert_equal taglist[i].k, tags[i].k
assert_equal taglist[i].v, tags[i].v
Expand All @@ -329,7 +329,7 @@ def test_tags
node = current_nodes(:node_with_versions)
taglist = create_list(:node_tag, 2, :node => node)
tags = Node.find(node.id).tags
assert_equal 2, tags.size
assert_equal taglist.count, tags.count
taglist.each do |tag|
assert_equal tag.v, tags[tag.k]
end
Expand Down
8 changes: 4 additions & 4 deletions test/models/old_node_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ def test_node_tags

node = nodes(:node_with_versions_v3)
tags = OldNode.find(node.id).old_tags.order(:k)
assert_equal 3, tags.count
assert_equal taglist_v3.count, tags.count
taglist_v3.sort_by!(&:k).each_index do |i|
assert_equal taglist_v3[i].k, tags[i].k
assert_equal taglist_v3[i].v, tags[i].v
end

node = nodes(:node_with_versions_v4)
tags = OldNode.find(node.id).old_tags.order(:k)
assert_equal 2, tags.count
assert_equal taglist_v4.count, tags.count
taglist_v4.sort_by!(&:k).each_index do |i|
assert_equal taglist_v4[i].k, tags[i].k
assert_equal taglist_v4[i].v, tags[i].v
Expand All @@ -118,14 +118,14 @@ def test_tags

node = nodes(:node_with_versions_v3)
tags = OldNode.find(node.id).tags
assert_equal 3, tags.size
assert_equal taglist_v3.count, tags.count
taglist_v3.each do |tag|
assert_equal tag.v, tags[tag.k]
end

node = nodes(:node_with_versions_v4)
tags = OldNode.find(node.id).tags
assert_equal 2, tags.size
assert_equal taglist_v4.count, tags.count
taglist_v4.each do |tag|
assert_equal tag.v, tags[tag.k]
end
Expand Down
8 changes: 4 additions & 4 deletions test/models/old_relation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ def test_relation_tags

relation = relations(:relation_with_versions_v3)
tags = OldRelation.find(relation.id).old_tags.order(:k)
assert_equal 3, tags.count
assert_equal taglist_v3.count, tags.count
taglist_v3.sort_by!(&:k).each_index do |i|
assert_equal taglist_v3[i].k, tags[i].k
assert_equal taglist_v3[i].v, tags[i].v
end

relation = relations(:relation_with_versions_v4)
tags = OldRelation.find(relation.id).old_tags.order(:k)
assert_equal 2, tags.count
assert_equal taglist_v4.count, tags.count
taglist_v4.sort_by!(&:k).each_index do |i|
assert_equal taglist_v4[i].k, tags[i].k
assert_equal taglist_v4[i].v, tags[i].v
Expand Down Expand Up @@ -114,14 +114,14 @@ def test_tags

relation = relations(:relation_with_versions_v3)
tags = OldRelation.find(relation.id).tags
assert_equal 3, tags.size
assert_equal taglist_v3.count, tags.count
taglist_v3.each do |tag|
assert_equal tag.v, tags[tag.k]
end

relation = relations(:relation_with_versions_v4)
tags = OldRelation.find(relation.id).tags
assert_equal 2, tags.size
assert_equal taglist_v4.count, tags.count
taglist_v4.each do |tag|
assert_equal tag.v, tags[tag.k]
end
Expand Down
8 changes: 4 additions & 4 deletions test/models/old_way_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ def test_way_tags

way = ways(:way_with_versions_v3)
tags = OldWay.find(way.id).old_tags.order(:k)
assert_equal 3, tags.count
assert_equal taglist_v3.count, tags.count
taglist_v3.sort_by!(&:k).each_index do |i|
assert_equal taglist_v3[i].k, tags[i].k
assert_equal taglist_v3[i].v, tags[i].v
end

way = ways(:way_with_versions_v4)
tags = OldWay.find(way.id).old_tags.order(:k)
assert_equal 2, tags.count
assert_equal taglist_v4.count, tags.count
taglist_v4.sort_by!(&:k).each_index do |i|
assert_equal taglist_v4[i].k, tags[i].k
assert_equal taglist_v4[i].v, tags[i].v
Expand All @@ -80,14 +80,14 @@ def test_tags

way = ways(:way_with_versions_v3)
tags = OldWay.find(way.id).tags
assert_equal 3, tags.size
assert_equal taglist_v3.count, tags.count
taglist_v3.each do |tag|
assert_equal tag.v, tags[tag.k]
end

way = ways(:way_with_versions_v4)
tags = OldWay.find(way.id).tags
assert_equal 2, tags.size
assert_equal taglist_v4.count, tags.count
taglist_v4.each do |tag|
assert_equal tag.v, tags[tag.k]
end
Expand Down
4 changes: 2 additions & 2 deletions test/models/relation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_relation_tags
taglist = create_list(:relation_tag, 2, :relation => relation)

tags = Relation.find(relation.id).relation_tags.order(:k)
assert_equal 2, tags.count
assert_equal taglist.count, tags.count
taglist.sort_by!(&:k).each_index do |i|
assert_equal taglist[i].k, tags[i].k
assert_equal taglist[i].v, tags[i].v
Expand All @@ -144,7 +144,7 @@ def test_tags
taglist = create_list(:relation_tag, 2, :relation => relation)

tags = Relation.find(relation.id).tags
assert_equal 2, tags.size
assert_equal taglist.count, tags.count
taglist.each do |tag|
assert_equal tag.v, tags[tag.k]
end
Expand Down
4 changes: 2 additions & 2 deletions test/models/way_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_way_tags
way = current_ways(:way_with_versions)
taglist = create_list(:way_tag, 2, :way => way)
tags = Way.find(way.id).way_tags.order(:k)
assert_equal 2, tags.count
assert_equal taglist.count, tags.count
taglist.sort_by!(&:k).each_index do |i|
assert_equal taglist[i].k, tags[i].k
assert_equal taglist[i].v, tags[i].v
Expand All @@ -178,7 +178,7 @@ def test_tags
way = current_ways(:way_with_versions)
taglist = create_list(:way_tag, 2, :way => way)
tags = Way.find(way.id).tags
assert_equal 2, tags.size
assert_equal taglist.count, tags.count
taglist.each do |tag|
assert_equal tag.v, tags[tag.k]
end
Expand Down

0 comments on commit 0da97d2

Please sign in to comment.