Distinguish user not present and list empty

This is a bit more thorough.
This commit is contained in:
Pau Perez
2021-02-04 13:19:04 +01:00
parent 88e22a78c2
commit 655fe887f9

View File

@@ -27,8 +27,9 @@ describe 'config/initializers/feature_toggles.rb' do
end
context 'when beta_testers is a list of emails' do
let(:other_user) { build(:user) }
context 'and the user is in the list' do
let(:other_user) { build(:user) }
before { ENV['BETA_TESTERS'] = "#{user.email}, #{other_user.email}" }
it 'enables the feature' do
@@ -40,6 +41,17 @@ describe 'config/initializers/feature_toggles.rb' do
end
context 'and the user is not in the list' do
before { ENV['BETA_TESTERS'] = "#{other_user.email}" }
it 'disables the feature' do
execute_initializer
enabled = OpenFoodNetwork::FeatureToggle.enabled?(:customer_balance, user)
expect(enabled).to eq(false)
end
end
context 'and the list is empty' do
before { ENV['BETA_TESTERS'] = '' }
it 'disables the feature' do