Move feature flag test setup into config (#34124)

This commit is contained in:
David Roetzel 2025-03-11 14:29:17 +01:00 committed by GitHub
parent dc43699b77
commit bedf808e02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 19 deletions

View file

@ -3,28 +3,23 @@
require 'rails_helper'
RSpec.describe Mastodon::Feature do
around do |example|
original_value = Rails.configuration.x.mastodon.experimental_features
Rails.configuration.x.mastodon.experimental_features = 'fasp,fetch_all_replies'
example.run
Rails.configuration.x.mastodon.experimental_features = original_value
end
describe '::fasp_enabled?' do
subject { described_class.fasp_enabled? }
it { is_expected.to be true }
end
describe '::fetch_all_replies_enabled?' do
subject { described_class.fetch_all_replies_enabled? }
describe '::testing_only_enabled?' do
subject { described_class.testing_only_enabled? }
it { is_expected.to be true }
end
describe '::unspecified_feature_enabled?' do
subject { described_class.unspecified_feature_enabled? }
context 'when example is not tagged with a feature' do
subject { described_class.unspecified_feature_enabled? }
it { is_expected.to be false }
it { is_expected.to be false }
end
context 'when example is tagged with a feature', feature: 'unspecified_feature' do
subject { described_class.unspecified_feature_enabled? }
it { is_expected.to be true }
end
end
end