Skip to content

Commit

Permalink
Use order(:id) in Tag tests so the arrays match
Browse files Browse the repository at this point in the history
  • Loading branch information
Marri committed Sep 1, 2017
1 parent f038ef7 commit c49f6f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/models/tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def create_tags

it "works with with_item_counts scope" do
tags = create_tags
fetched = Label.where(id: tags.map(&:id)).select(:id).with_item_counts
fetched = Label.where(id: tags.map(&:id)).select(:id).order(:id).with_item_counts
expect(fetched).to eq(tags)
expect(fetched.map(&:post_count)).to eq([0, 1, 2])
end

it "works without with_item_counts scope" do
tags = create_tags
fetched = Label.where(id: tags.map(&:id))
fetched = Label.where(id: tags.map(&:id)).order(:id)
expect(fetched).to eq(tags)
expect(fetched.map(&:post_count)).to eq([0, 1, 2])
end
Expand All @@ -87,14 +87,14 @@ def create_tags

it "works with with_item_counts scope" do
tags = create_tags
fetched = GalleryGroup.where(id: tags.map(&:id)).select(:id).with_item_counts
fetched = GalleryGroup.where(id: tags.map(&:id)).select(:id).order(:id).with_item_counts
expect(fetched).to eq(tags)
expect(fetched.map(&:character_count)).to eq([0, 1, 2])
end

it "works without with_item_counts scope" do
tags = create_tags
fetched = GalleryGroup.where(id: tags.map(&:id))
fetched = GalleryGroup.where(id: tags.map(&:id)).order(:id)
expect(fetched).to eq(tags)
expect(fetched.map(&:character_count)).to eq([0, 1, 2])
end
Expand All @@ -112,14 +112,14 @@ def create_tags

it "works with with_item_counts scope" do
tags = create_tags
fetched = GalleryGroup.where(id: tags.map(&:id)).select(:id).with_item_counts
fetched = GalleryGroup.where(id: tags.map(&:id)).select(:id).order(:id).with_item_counts
expect(fetched).to eq(tags)
expect(fetched.map(&:gallery_count)).to eq([0, 1, 2])
end

it "works without with_item_counts scope" do
tags = create_tags
fetched = GalleryGroup.where(id: tags.map(&:id))
fetched = GalleryGroup.where(id: tags.map(&:id)).order(:id)
expect(fetched).to eq(tags)
expect(fetched.map(&:gallery_count)).to eq([0, 1, 2])
end
Expand Down

0 comments on commit c49f6f6

Please sign in to comment.