Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2016-04-16 22:09:08 +0300
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2016-05-06 11:47:11 +0300
commit3bdc57f0a710b3769381ecad7ea4098223ecff56 (patch)
treeabfe22d7d40c7d3e2912d659b045273254767dea /spec/models/award_emoji_spec.rb
parent05920a7964a039fd65d6b665c2ebd130d5ef949c (diff)
Create table for award emoji
Diffstat (limited to 'spec/models/award_emoji_spec.rb')
-rw-r--r--spec/models/award_emoji_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/award_emoji_spec.rb b/spec/models/award_emoji_spec.rb
new file mode 100644
index 00000000000..fd3712b7d43
--- /dev/null
+++ b/spec/models/award_emoji_spec.rb
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+describe AwardEmoji, models: true do
+ describe 'Associations' do
+ it { is_expected.to belong_to(:awardable) }
+ it { is_expected.to belong_to(:user) }
+ end
+
+ describe 'modules' do
+ it { is_expected.to include_module(Participable) }
+ end
+
+ describe "validations" do
+ it { is_expected.to validate_presence_of(:awardable) }
+ it { is_expected.to validate_presence_of(:user) }
+ it { is_expected.to validate_presence_of(:name) }
+ it { is_expected.to validate_presence_of(:awardable) }
+
+ # To circumvent a bug in the shoulda matchers
+ describe "scoped uniqueness validation" do
+ it "rejects duplicate award emoji" do
+ user = create(:user)
+ issue = create(:issue)
+ create(:award_emoji, user: user, awardable: issue)
+ new_award = AwardEmoji.new(user: user, awardable: issue, name: "thumbsup")
+
+ expect(new_award).not_to be_valid
+ end
+ end
+ end
+end