summaryrefslogtreecommitdiff
path: root/spec/presenters
diff options
context:
space:
mode:
authorLuke Duncalfe <lduncalfe@eml.cc>2019-06-21 16:45:27 +1200
committerLuke Duncalfe <lduncalfe@eml.cc>2019-06-28 12:03:33 +1200
commit4b9b2a43d02fc5154f780ade7fe76c02420fff15 (patch)
tree6ada662de1b913c6d265a554d5702c8a68788fae /spec/presenters
parent62a40c5170cbecfc77dcb5fc97a23f3e93898a53 (diff)
downloadgitlab-ce-4b9b2a43d02fc5154f780ade7fe76c02420fff15.tar.gz
GraphQL mutations for add, remove and toggle emoji62826-graphql-emoji-mutations
Adding new `AddAwardEmoji`, `RemoveAwardEmoji` and `ToggleAwardEmoji` GraphQL mutations. Adding new `#authorized_find_with_pre_checks!` and (unused, but for completeness `#authorized_find_with_post_checks!`) authorization methods. These allow us to perform an authorized find, and run our own additional checks before or after the authorization runs. https://gitlab.com/gitlab-org/gitlab-ce/issues/62826
Diffstat (limited to 'spec/presenters')
-rw-r--r--spec/presenters/award_emoji_presenter_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/presenters/award_emoji_presenter_spec.rb b/spec/presenters/award_emoji_presenter_spec.rb
new file mode 100644
index 00000000000..e2ada2a3c93
--- /dev/null
+++ b/spec/presenters/award_emoji_presenter_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe AwardEmojiPresenter do
+ let(:emoji_name) { 'thumbsup' }
+ let(:award_emoji) { build(:award_emoji, name: emoji_name) }
+ let(:presenter) { described_class.new(award_emoji) }
+
+ describe '#description' do
+ it { expect(presenter.description).to eq Gitlab::Emoji.emojis[emoji_name]['description'] }
+ end
+
+ describe '#unicode' do
+ it { expect(presenter.unicode).to eq Gitlab::Emoji.emojis[emoji_name]['unicode'] }
+ end
+
+ describe '#unicode_version' do
+ it { expect(presenter.unicode_version).to eq Gitlab::Emoji.emoji_unicode_version(emoji_name) }
+ end
+
+ describe '#emoji' do
+ it { expect(presenter.emoji).to eq Gitlab::Emoji.emojis[emoji_name]['moji'] }
+ end
+
+ describe 'when presenting an award emoji with an invalid name' do
+ let(:emoji_name) { 'invalid-name' }
+
+ it 'returns nil for all properties' do
+ expect(presenter.description).to be_nil
+ expect(presenter.emoji).to be_nil
+ expect(presenter.unicode).to be_nil
+ expect(presenter.unicode_version).to be_nil
+ end
+ end
+end