Commit aa6a580f authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove models from parameterized test

Fixes broken master
parent efa0c024
...@@ -6,19 +6,45 @@ describe EE::TrialHelper do ...@@ -6,19 +6,45 @@ describe EE::TrialHelper do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
describe '#show_trial_errors?' do describe '#show_trial_errors?' do
where(:namespace, :trial_result, :expected_result) do shared_examples 'shows errors based on trial generation result' do
nil | { success: true } | false where(:trial_result, :expected_result) do
nil | nil | nil nil | nil
build(:namespace) | nil | nil { success: true } | false
build(:namespace) | { success: true } | false { success: false } | true
build(:namespace, name: 'admin') | { success: true } | true end
nil | { success: false } | true
build(:namespace) | { success: false } | true with_them 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 end
with_them do context 'when namespace is valid' do
it 'show errors when Namespace is invalid or Trial generation was unsuccessful' do let(:namespace) { build(:namespace) }
expect(helper.show_trial_errors?(namespace, trial_result)).to eq(expected_result)
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
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