diff options
author | ysksn <bluewhale1982@gmail.com> | 2017-11-08 15:28:17 +0900 |
---|---|---|
committer | Yamagishi Kazutoshi <ykzts@desire.sh> | 2017-11-08 15:28:17 +0900 |
commit | 97fc2da2e044980de01ed88eb7f0836fc718fb75 (patch) | |
tree | 8226d3e651b85e297560b8d4dbd43476e1913852 /spec | |
parent | 889ada5ee257f7cecce55bd2366161d0a673a4f8 (diff) |
Add tests for CustomEmoji#local? and #object_type (#5621)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/custom_emoji_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/custom_emoji_spec.rb b/spec/models/custom_emoji_spec.rb index cb51e9519..bb150b837 100644 --- a/spec/models/custom_emoji_spec.rb +++ b/spec/models/custom_emoji_spec.rb @@ -1,6 +1,35 @@ require 'rails_helper' RSpec.describe CustomEmoji, type: :model do + describe '#local?' do + let(:custom_emoji) { Fabricate(:custom_emoji, domain: domain) } + + subject { custom_emoji.local? } + + context 'domain is nil' do + let(:domain) { nil } + + it 'returns true' do + is_expected.to be true + end + end + + context 'domain is present' do + let(:domain) { 'example.com' } + + it 'returns false' do + is_expected.to be false + end + end + end + + describe '#object_type' do + it 'returns :emoji' do + custom_emoji = Fabricate(:custom_emoji) + expect(custom_emoji.object_type).to be :emoji + end + end + describe '.from_text' do let!(:emojo) { Fabricate(:custom_emoji) } |