Skip to content

Commit

Permalink
fix randomly failing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZogStriP committed Mar 27, 2017
1 parent a4b6589 commit dd1cc23
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/components/topics_bulk_action_spec.rb
Expand Up @@ -198,7 +198,7 @@
topic_ids = tba.perform!
expect(topic_ids).to eq([topic.id])
topic.reload
expect(topic.tags.map(&:name).sort).to eq(['newtag', tag1.name].sort)
expect(topic.tags.map(&:name)).to contain_exactly('newtag', tag1.name)
end

it "can change the tags but not create new ones" do
Expand All @@ -207,7 +207,7 @@
topic_ids = tba.perform!
expect(topic_ids).to eq([topic.id])
topic.reload
expect(topic.tags.map(&:name)).to eq([tag1.name])
expect(topic.tags.map(&:name)).to contain_exactly(tag1.name)
end

it "can remove all tags" do
Expand Down Expand Up @@ -251,15 +251,15 @@
topic_ids = tba.perform!
expect(topic_ids).to eq([topic.id])
topic.reload
expect(topic.tags.map(&:name).sort).to eq([tag1.name, tag2.name, tag3.name, 'newtag'].sort)
expect(topic.tags.map(&:name)).to contain_exactly(tag1.name, tag2.name, tag3.name, 'newtag')
end

it "can append empty tags" do
tba = TopicsBulkAction.new(topic.user, [topic.id], type: 'append_tags', tags: [])
topic_ids = tba.perform!
expect(topic_ids).to eq([topic.id])
topic.reload
expect(topic.tags.map(&:name).sort).to eq([tag1.name, tag2.name].sort)
expect(topic.tags.map(&:name)).to contain_exactly(tag1.name, tag2.name)
end

context "when the user can't create new topics" do
Expand All @@ -272,7 +272,7 @@
topic_ids = tba.perform!
expect(topic_ids).to eq([topic.id])
topic.reload
expect(topic.tags.map(&:name)).to eq([tag1.name, tag2.name, tag3.name])
expect(topic.tags.map(&:name)).to contain_exactly(tag1.name, tag2.name, tag3.name)
end
end

Expand All @@ -286,7 +286,7 @@
topic_ids = tba.perform!
expect(topic_ids).to eq([])
topic.reload
expect(topic.tags.map(&:name).sort).to eq([tag1.name, tag2.name].sort)
expect(topic.tags.map(&:name)).to contain_exactly(tag1.name, tag2.name)
end
end
end
Expand Down

2 comments on commit dd1cc23

@tgxworld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@SamSaffron
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice this is the 3rd "works if db returns stuff randomly in the correct order" type heisentest!

Please sign in to comment.