summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/models/cluster_application_version_shared_examples.rb
blob: cf7010c48c20a6f0f39163a1644aa4b8ff6d28e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

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 { 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, cluster: cluster) }
      let(:version) { application.class.const_get(:VERSION, false) }

      it { is_expected.to be_falsey }
    end
  end
end