diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2017-11-06 19:02:28 +0300 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2017-11-06 19:02:28 +0300 |
commit | 2802b5bb52b6ba28e6eeb1813f3fd3a79d2c03c4 (patch) | |
tree | 57bb23f3ec8f808209059cf1b4791b5cefeb20f9 /spec/serializers/cluster_application_entity_spec.rb | |
parent | b893a858808f1e2aefca4e3f665d633d31fa5937 (diff) |
Add ClusterApplicationEntity tests
Diffstat (limited to 'spec/serializers/cluster_application_entity_spec.rb')
-rw-r--r-- | spec/serializers/cluster_application_entity_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/serializers/cluster_application_entity_spec.rb b/spec/serializers/cluster_application_entity_spec.rb new file mode 100644 index 00000000000..61cebcefa28 --- /dev/null +++ b/spec/serializers/cluster_application_entity_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe ClusterApplicationEntity do + describe '#as_json' do + let(:application) { build(:applications_helm) } + subject { described_class.new(application).as_json } + + it 'has name' do + expect(subject[:name]).to eq(application.name) + end + + it 'has status' do + expect(subject[:status]).to eq(:installable) + end + + it 'has no status_reason' do + expect(subject[:status_reason]).to be_nil + end + + context 'when application is errored' do + let(:application) { build(:applications_helm, :errored) } + + 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 |