Commit a7270b34 authored by Thong Kuah's avatar Thong Kuah

Set version when externally installed

parent db87dc61
......@@ -5,11 +5,17 @@ module Clusters
module ApplicationVersion
extend ActiveSupport::Concern
EXTERNAL_VERSION = 'EXTERNALLY_INSTALLED'
included do
state_machine :status do
before_transition any => [:installed, :updated] do |application|
application.version = application.class.const_get(:VERSION, false)
end
before_transition any => [:externally_installed] do |application|
application.version = EXTERNAL_VERSION
end
end
end
......
......@@ -47,4 +47,15 @@ RSpec.shared_examples 'cluster application version specs' do |application_name|
end
end
end
describe '#make_externally_installed' do
subject { build(application_name) }
it 'sets to a special version' do
subject.make_externally_installed!
expect(subject).to be_persisted
expect(subject.version).to eq('EXTERNALLY_INSTALLED')
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