summaryrefslogtreecommitdiff
path: root/spec/serializers/cluster_serializer_spec.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-10-31 01:03:58 +0900
committerShinya Maeda <shinya@gitlab.com>2017-10-31 01:03:58 +0900
commitc43a82cdfa8c5c1d045e2628330953227dcc9767 (patch)
treecb60c65b085979c380b8fa83e663b895e6cd3cc1 /spec/serializers/cluster_serializer_spec.rb
parent709b8b6186b06372bf9bfebe9d36a0fea9226a1b (diff)
downloadgitlab-ce-c43a82cdfa8c5c1d045e2628330953227dcc9767.tar.gz
specs for serializers.
Diffstat (limited to 'spec/serializers/cluster_serializer_spec.rb')
-rw-r--r--spec/serializers/cluster_serializer_spec.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/spec/serializers/cluster_serializer_spec.rb b/spec/serializers/cluster_serializer_spec.rb
index 1ac6784d28f..e5da92a451e 100644
--- a/spec/serializers/cluster_serializer_spec.rb
+++ b/spec/serializers/cluster_serializer_spec.rb
@@ -1,15 +1,20 @@
require 'spec_helper'
describe ClusterSerializer do
- let(:serializer) do
- described_class.new
- end
-
describe '#represent_status' do
- subject { serializer.represent_status(resource) }
+ subject { described_class.new.represent_status(cluster) }
+
+ context 'when provider type is gcp' do
+ let(:cluster) { create(:cluster, provider_type: :gcp, provider_gcp: provider) }
+ let(:provider) { create(:provider_gcp, :errored) }
+
+ it 'serializes only status' do
+ expect(subject.keys).to contain_exactly(:status, :status_reason)
+ end
+ end
- context 'when represents only status' do
- let(:resource) { create(:gcp_cluster, :errored) }
+ 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)