Commit fecbe2ed authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '33908-fix-parameterized-spec' into 'master'

Remove models from parameterized test

Closes #33908

See merge request gitlab-org/gitlab!18473
parents 6d395185 aa6a580f
......@@ -6,20 +6,46 @@ describe EE::TrialHelper do
using RSpec::Parameterized::TableSyntax
describe '#show_trial_errors?' do
where(:namespace, :trial_result, :expected_result) do
nil | { success: true } | false
nil | nil | nil
build(:namespace) | nil | nil
build(:namespace) | { success: true } | false
build(:namespace, name: 'admin') | { success: true } | true
nil | { success: false } | true
build(:namespace) | { success: false } | true
shared_examples 'shows errors based on trial generation result' do
where(:trial_result, :expected_result) do
nil | nil
{ success: true } | false
{ success: false } | true
end
with_them do
it 'show errors when Namespace is invalid or Trial generation was unsuccessful' do
it 'show errors when trial generation was unsuccessful' do
expect(helper.show_trial_errors?(namespace, trial_result)).to eq(expected_result)
end
end
end
context 'when namespace is nil' do
let(:namespace) { nil }
it_behaves_like 'shows errors based on trial generation result'
end
context 'when namespace is valid' do
let(:namespace) { build(:namespace) }
it_behaves_like 'shows errors based on trial generation result'
end
context 'when namespace is invalid' do
let(:namespace) { build(:namespace, name: 'admin') }
where(:trial_result, :expected_result) do
nil | true
{ success: true } | true
{ success: false } | true
end
with_them do
it 'show errors regardless of trial generation result' do
expect(helper.show_trial_errors?(namespace, trial_result)).to eq(expected_result)
end
end
end
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