Commit bdd752c9 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Remove redundant contexts in specs

parent c996970b
......@@ -197,24 +197,20 @@ RSpec.describe EE::TrialHelper do
it { is_expected.to be_falsey }
end
context 'when feature flag is enabled' do
where(:can_extend_trial, :can_reactivate_trial, :result) do
false | false | false
true | false | true
false | true | true
true | true | true
end
with_them do
before do
stub_feature_flags(allow_extend_reactivate_trial: true)
allow(namespace).to receive(:can_extend_trial?).and_return(can_extend_trial)
allow(namespace).to receive(:can_reactivate_trial?).and_return(can_reactivate_trial)
end
where(:can_extend_trial, :can_reactivate_trial, :result) do
false | false | false
true | false | true
false | true | true
true | true | true
end
it { is_expected.to eq(result) }
with_them do
before do
allow(namespace).to receive(:can_extend_trial?).and_return(can_extend_trial)
allow(namespace).to receive(:can_reactivate_trial?).and_return(can_reactivate_trial)
end
it { is_expected.to eq(result) }
end
end
......@@ -253,22 +249,20 @@ RSpec.describe EE::TrialHelper do
end
end
context 'when feature flag is enabled' do
context 'when trial can be extended' do
before do
allow(namespace).to receive(:can_extend_trial?).and_return(true)
end
it { is_expected.to eq({ namespace_id: 1, plan_name: 'Ultimate', action: 'extend' }) }
context 'when trial can be extended' do
before do
allow(namespace).to receive(:can_extend_trial?).and_return(true)
end
context 'when trial can be reactivated' do
before do
allow(namespace).to receive(:can_reactivate_trial?).and_return(true)
end
it { is_expected.to eq({ namespace_id: 1, plan_name: 'Ultimate', action: 'extend' }) }
end
it { is_expected.to eq({ namespace_id: 1, plan_name: 'Ultimate', action: 'reactivate' }) }
context 'when trial can be reactivated' do
before do
allow(namespace).to receive(:can_reactivate_trial?).and_return(true)
end
it { is_expected.to eq({ namespace_id: 1, plan_name: 'Ultimate', action: 'reactivate' }) }
end
end
end
......@@ -1261,22 +1261,20 @@ RSpec.describe Namespace do
it { is_expected.to be_falsey }
end
context 'when feature flag is enabled' do
where(:trial_active, :trial_extended_or_reactivated, :can_extend_trial) do
false | false | false
false | true | false
true | false | true
true | true | false
end
with_them do
before do
allow(namespace).to receive(:trial_active?).and_return(trial_active)
allow(namespace).to receive(:trial_extended_or_reactivated?).and_return(trial_extended_or_reactivated)
end
where(:trial_active, :trial_extended_or_reactivated, :can_extend_trial) do
false | false | false
false | true | false
true | false | true
true | true | false
end
it { is_expected.to be can_extend_trial }
with_them do
before do
allow(namespace).to receive(:trial_active?).and_return(trial_active)
allow(namespace).to receive(:trial_extended_or_reactivated?).and_return(trial_extended_or_reactivated)
end
it { is_expected.to be can_extend_trial }
end
end
......@@ -1296,36 +1294,34 @@ RSpec.describe Namespace do
it { is_expected.to be_falsey }
end
context 'when feature flag is enabled' do
where(:trial_active, :never_had_trial, :trial_extended_or_reactivated, :free_plan, :can_reactivate_trial) do
false | false | false | false | false
false | false | false | true | true
false | false | true | false | false
false | false | true | true | false
false | true | false | false | false
false | true | false | true | false
false | true | true | false | false
false | true | true | true | false
true | false | false | false | false
true | false | false | true | false
true | false | true | false | false
true | false | true | true | false
true | true | false | false | false
true | true | false | true | false
true | true | true | false | false
true | true | true | true | false
end
with_them do
before do
allow(namespace).to receive(:trial_active?).and_return(trial_active)
allow(namespace).to receive(:never_had_trial?).and_return(never_had_trial)
allow(namespace).to receive(:trial_extended_or_reactivated?).and_return(trial_extended_or_reactivated)
allow(namespace).to receive(:free_plan?).and_return(free_plan)
end
where(:trial_active, :never_had_trial, :trial_extended_or_reactivated, :free_plan, :can_reactivate_trial) do
false | false | false | false | false
false | false | false | true | true
false | false | true | false | false
false | false | true | true | false
false | true | false | false | false
false | true | false | true | false
false | true | true | false | false
false | true | true | true | false
true | false | false | false | false
true | false | false | true | false
true | false | true | false | false
true | false | true | true | false
true | true | false | false | false
true | true | false | true | false
true | true | true | false | false
true | true | true | true | false
end
it { is_expected.to be can_reactivate_trial }
with_them do
before do
allow(namespace).to receive(:trial_active?).and_return(trial_active)
allow(namespace).to receive(:never_had_trial?).and_return(never_had_trial)
allow(namespace).to receive(:trial_extended_or_reactivated?).and_return(trial_extended_or_reactivated)
allow(namespace).to receive(:free_plan?).and_return(free_plan)
end
it { is_expected.to be can_reactivate_trial }
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment