2017-11-06 11:02:28 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ClusterApplicationEntity do
|
|
|
|
describe '#as_json' do
|
2017-11-07 03:34:07 -05:00
|
|
|
let(:application) { build(:cluster_applications_helm) }
|
2017-11-06 11:02:28 -05:00
|
|
|
subject { described_class.new(application).as_json }
|
|
|
|
|
|
|
|
it 'has name' do
|
|
|
|
expect(subject[:name]).to eq(application.name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has status' do
|
2017-11-07 11:32:12 -05:00
|
|
|
expect(subject[:status]).to eq(:not_installable)
|
2017-11-06 11:02:28 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has no status_reason' do
|
|
|
|
expect(subject[:status_reason]).to be_nil
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when application is errored' do
|
2017-11-07 03:34:07 -05:00
|
|
|
let(:application) { build(:cluster_applications_helm, :errored) }
|
2017-11-06 11:02:28 -05:00
|
|
|
|
|
|
|
it 'has corresponded data' do
|
|
|
|
expect(subject[:status]).to eq(:errored)
|
|
|
|
expect(subject[:status_reason]).not_to be_nil
|
|
|
|
expect(subject[:status_reason]).to eq(application.status_reason)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|