Commit 8a4fba2e authored by Thong Kuah's avatar Thong Kuah

Improve time to run cluster application specs

This reduces the time to run the spec/models/clusters/applications/* by
40 seconds (200 => 160 seconds) on my computer.
parent 52ffbbb9
......@@ -264,6 +264,8 @@ RSpec.shared_examples 'cluster application status specs' do |application_name|
describe '#available?' do
using RSpec::Parameterized::TableSyntax
let_it_be(:cluster) { create(:cluster, :provided_by_gcp) }
where(:trait, :available) do
:not_installable | false
:installable | false
......@@ -280,7 +282,7 @@ RSpec.shared_examples 'cluster application status specs' do |application_name|
end
with_them do
subject { build(application_name, trait) }
subject { build(application_name, trait, cluster: cluster) }
if params[:available]
it { is_expected.to be_available }
......
......@@ -2,16 +2,18 @@
RSpec.shared_examples 'cluster application version specs' do |application_name|
describe 'update_available?' do
let_it_be(:cluster) { create(:cluster, :provided_by_gcp) }
let(:version) { '0.0.0' }
subject { create(application_name, :installed, version: version).update_available? }
subject { build(application_name, :installed, version: version, cluster: cluster).update_available? }
context 'version is not the same as VERSION' do
it { is_expected.to be_truthy }
end
context 'version is the same as VERSION' do
let(:application) { build(application_name) }
let(:application) { build(application_name, cluster: cluster) }
let(:version) { application.class.const_get(:VERSION, false) }
it { is_expected.to be_falsey }
......
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