debian-mirror-gitlab/spec/presenters/award_emoji_presenter_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1 KiB
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe AwardEmojiPresenter do
2019-09-30 21:07:59 +05:30
let(:emoji_name) { 'thumbsup' }
let(:award_emoji) { build(:award_emoji, name: emoji_name) }
let(:presenter) { described_class.new(award_emoji) }
2021-12-11 22:18:48 +05:30
let(:emoji) { TanukiEmoji.find_by_alpha_code(emoji_name) }
2019-09-30 21:07:59 +05:30
describe '#description' do
2021-12-11 22:18:48 +05:30
it { expect(presenter.description).to eq emoji.description }
2019-09-30 21:07:59 +05:30
end
describe '#unicode' do
2021-12-11 22:18:48 +05:30
it { expect(presenter.unicode).to eq emoji.hex }
2019-09-30 21:07:59 +05:30
end
describe '#unicode_version' do
2021-12-11 22:18:48 +05:30
it { expect(presenter.unicode_version).to eq('6.0') }
2019-09-30 21:07:59 +05:30
end
describe '#emoji' do
2021-12-11 22:18:48 +05:30
it { expect(presenter.emoji).to eq emoji.codepoints }
2019-09-30 21:07:59 +05:30
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