Refactor: インスタンスで利用可能な機能を検出する処理 (#721)

This commit is contained in:
KMY(雪あすか) 2024-04-19 09:04:45 +09:00 committed by GitHub
parent 3af1b90795
commit 389ae9d339
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 7 deletions

View file

@ -3,7 +3,7 @@
require 'rails_helper'
RSpec.describe InstanceInfo do
describe '.available_features' do
describe '.available_features#emoji_reaction' do
subject { described_class.available_features('example.com')[:emoji_reaction] }
it 'availables if local account' do
@ -45,4 +45,18 @@ RSpec.describe InstanceInfo do
expect(subject).to be false
end
end
describe '.available_features#circle' do
subject { described_class.available_features('example.com')[:circle] }
it 'does not available if misskey server' do
Fabricate(:instance_info, domain: 'example.com', software: 'misskey')
expect(subject).to be false
end
it 'availables if misskey server with features' do
Fabricate(:instance_info, domain: 'example.com', software: 'misskey', data: { metadata: { features: ['circle'] } })
expect(subject).to be true
end
end
end