Fix: スタンプのテスト

This commit is contained in:
KMY 2023-10-15 12:21:39 +09:00 committed by KMY(雪あすか)
parent 5ac46b4dc6
commit e7e70b21d2
3 changed files with 18 additions and 3 deletions

View file

@ -43,6 +43,14 @@ class EmojiReaction < ApplicationRecord
custom_emoji? && !custom_emoji.local?
end
def sign?
true
end
def object_type
:emoji_reaction
end
private
def refresh_cache

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
Fabricator(:emoji_reaction) do
account { Fabricate.build(:account) }
status { Fabricate.build(:status) }
name '😀'
end

View file

@ -99,7 +99,7 @@ RSpec.describe EmojiReactService, type: :service do
context 'with custom emoji of remote' do
let(:name) { 'ohagi@foo.bar' }
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) }
@ -113,7 +113,7 @@ RSpec.describe EmojiReactService, type: :service do
context 'with custom emoji of remote without existing one' do
let(:name) { 'ohagi@foo.bar' }
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
@ -122,7 +122,7 @@ RSpec.describe EmojiReactService, type: :service do
context 'with custom emoji of remote but local has same name emoji' do
let(:name) { 'ohagi@foo.bar' }
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)