mastodon/spec/models/concerns/status/interaction_policy_concern_spec.rb
Claire 5a88b7f683
Some checks failed
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (3.2) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Bundler Audit / security (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
Add experimental basic quote post authoring (#35355)
2025-07-25 12:35:24 +00:00

43 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Status::InteractionPolicyConcern do
let(:status) { Fabricate(:status, quote_approval_policy: (0b0101 << 16) | 0b0010) }
describe '#quote_policy_as_keys' do
it 'returns the expected values' do
expect(status.quote_policy_as_keys(:automatic)).to eq ['unknown', 'followers']
expect(status.quote_policy_as_keys(:manual)).to eq ['public']
end
end
describe '#quote_policy_for_account' do
let(:account) { Fabricate(:account) }
context 'when the account is not following the user' do
it 'returns :manual because of the public entry in the manual policy' do
expect(status.quote_policy_for_account(account)).to eq :manual
end
end
context 'when the account is following the user' do
before do
account.follow!(status.account)
end
it 'returns :automatic because of the followers entry in the automatic policy' do
expect(status.quote_policy_for_account(account)).to eq :automatic
end
end
context 'when the account falls into the unknown bucket' do
let(:status) { Fabricate(:status, quote_approval_policy: (0b0001 << 16) | 0b0100) }
it 'returns :automatic because of the followers entry in the automatic policy' do
expect(status.quote_policy_for_account(account)).to eq :unknown
end
end
end
end