Skip to content

Commit

Permalink
Fix: スタンプのテスト
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Oct 15, 2023
1 parent 7d85028 commit 7aa1011
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/models/emoji_reaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ def remote_custom_emoji?
custom_emoji? && !custom_emoji.local?
end

def sign?
true
end

def object_type
:emoji_reaction
end

private

def refresh_cache
Expand Down
7 changes: 7 additions & 0 deletions spec/fabricators/emoji_reaction_fabricator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

Fabricator(:emoji_reaction) do
account { Fabricate.build(:account) }
status { Fabricate.build(:status) }
name '😀'
end
6 changes: 3 additions & 3 deletions spec/services/emoji_react_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

context 'with custom emoji of remote' do
let(:name) { '[email protected]' }
let!(:custom_emoji) { Fabricate(:custom_emoji, shortcode: 'ohagi', domain: 'foo.bar') }
let!(:custom_emoji) { Fabricate(:custom_emoji, shortcode: 'ohagi', domain: 'foo.bar', uri: 'https://foo.bar/emoji/ohagi') }

before { Fabricate(:emoji_reaction, status: status, name: 'ohagi', custom_emoji: custom_emoji) }

Expand All @@ -113,7 +113,7 @@
context 'with custom emoji of remote without existing one' do
let(:name) { '[email protected]' }

before { Fabricate(:custom_emoji, shortcode: 'ohagi', domain: 'foo.bar') }
before { Fabricate(:custom_emoji, shortcode: 'ohagi', domain: 'foo.bar', uri: 'https://foo.bar/emoji/ohagi') }

it 'react with emoji' do
expect(subject.count).to eq 0
Expand All @@ -122,7 +122,7 @@

context 'with custom emoji of remote but local has same name emoji' do
let(:name) { '[email protected]' }
let!(:custom_emoji) { Fabricate(:custom_emoji, shortcode: 'ohagi', domain: 'foo.bar') }
let!(:custom_emoji) { Fabricate(:custom_emoji, shortcode: 'ohagi', domain: 'foo.bar', uri: 'https://foo.bar/emoji/ohagi') }

before do
Fabricate(:custom_emoji, shortcode: 'ohagi', domain: nil)
Expand Down

0 comments on commit 7aa1011

Please sign in to comment.