summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2018-10-27 23:52:26 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2018-11-01 07:45:36 +0800
commit8df7e6021b0da30e3b7550ca83cd9ab3f991c235 (patch)
tree3405c6855ff3b1b78d488be8d041ea2b1ab19005 /spec/models
parent69dcab2311e84b1a12cefab2cd92ef37ff97e38f (diff)
downloadgitlab-ce-8df7e6021b0da30e3b7550ca83cd9ab3f991c235.tar.gz
Fix tests
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/awardable_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/models/concerns/awardable_spec.rb b/spec/models/concerns/awardable_spec.rb
index 69083bdc125..debc02fa51f 100644
--- a/spec/models/concerns/awardable_spec.rb
+++ b/spec/models/concerns/awardable_spec.rb
@@ -24,13 +24,29 @@ describe Awardable do
end
end
- describe ".awarded" do
+ describe "#awarded" do
it "filters by user and emoji name" do
expect(Issue.awarded(award_emoji.user, "thumbsup")).to be_empty
expect(Issue.awarded(award_emoji.user, "thumbsdown")).to eq [issue]
expect(Issue.awarded(award_emoji2.user, "thumbsup")).to eq [issue2]
expect(Issue.awarded(award_emoji2.user, "thumbsdown")).to be_empty
end
+
+ it "filters by user and any emoji" do
+ issue3 = create(:issue)
+ create(:award_emoji, awardable: issue3, name: "star", user: award_emoji.user)
+ create(:award_emoji, awardable: issue3, name: "star", user: award_emoji2.user)
+
+ expect(Issue.awarded(award_emoji.user)).to eq [issue, issue3]
+ expect(Issue.awarded(award_emoji2.user)).to eq [issue2, issue3]
+ end
+ end
+
+ describe "#not_awarded" do
+ it "returns issues not awarded by user" do
+ expect(Issue.not_awarded(award_emoji.user)).to eq [issue2]
+ expect(Issue.not_awarded(award_emoji2.user)).to eq [issue]
+ end
end
end