diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-10-31 01:03:58 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-10-31 01:03:58 +0900 |
commit | c43a82cdfa8c5c1d045e2628330953227dcc9767 (patch) | |
tree | cb60c65b085979c380b8fa83e663b895e6cd3cc1 /spec/serializers/cluster_serializer_spec.rb | |
parent | 709b8b6186b06372bf9bfebe9d36a0fea9226a1b (diff) | |
download | gitlab-ce-c43a82cdfa8c5c1d045e2628330953227dcc9767.tar.gz |
specs for serializers.
Diffstat (limited to 'spec/serializers/cluster_serializer_spec.rb')
-rw-r--r-- | spec/serializers/cluster_serializer_spec.rb | 19 |
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) |