summaryrefslogtreecommitdiff
path: root/spec/serializers/cluster_serializer_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/serializers/cluster_serializer_spec.rb')
-rw-r--r--spec/serializers/cluster_serializer_spec.rb38
1 files changed, 28 insertions, 10 deletions
diff --git a/spec/serializers/cluster_serializer_spec.rb b/spec/serializers/cluster_serializer_spec.rb
index db0e65ca0fa..39551649ff0 100644
--- a/spec/serializers/cluster_serializer_spec.rb
+++ b/spec/serializers/cluster_serializer_spec.rb
@@ -3,23 +3,41 @@
require 'spec_helper'
describe ClusterSerializer do
+ let(:cluster) { create(:cluster, :project, provider_type: :user) }
+
+ describe '#represent_list' do
+ subject { described_class.new.represent_list(cluster).keys }
+
+ it 'serializes attrs correctly' do
+ is_expected.to contain_exactly(
+ :cluster_type,
+ :enabled,
+ :environment_scope,
+ :name,
+ :nodes,
+ :path,
+ :status)
+ end
+ end
+
describe '#represent_status' do
- subject { described_class.new.represent_status(cluster) }
+ subject { described_class.new.represent_status(cluster).keys }
+
+ context 'when provider type is gcp and cluster is errored' do
+ let(:cluster) do
+ errored_provider = create(:cluster_provider_gcp, :errored)
- context 'when provider type is gcp' do
- let(:cluster) { create(:cluster, provider_type: :gcp, provider_gcp: provider) }
- let(:provider) { create(:cluster_provider_gcp, :errored) }
+ create(:cluster, provider_type: :gcp, provider_gcp: errored_provider)
+ end
- it 'serializes only status' do
- expect(subject.keys).to contain_exactly(:status, :status_reason, :applications)
+ it 'serializes attrs correctly' do
+ is_expected.to contain_exactly(:status, :status_reason, :applications)
end
end
context 'when provider type is user' do
- let(:cluster) { create(:cluster, provider_type: :user) }
-
- it 'serializes only status' do
- expect(subject.keys).to contain_exactly(:status, :status_reason, :applications)
+ it 'serializes attrs correctly' do
+ is_expected.to contain_exactly(:status, :status_reason, :applications)
end
end
end