debian-mirror-gitlab/spec/serializers/cluster_serializer_spec.rb

45 lines
1.1 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
describe ClusterSerializer do
2020-05-24 23:13:21 +05:30
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
2018-03-17 18:26:18 +05:30
describe '#represent_status' do
2020-05-24 23:13:21 +05:30
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)
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
create(:cluster, provider_type: :gcp, provider_gcp: errored_provider)
end
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
it 'serializes attrs correctly' do
is_expected.to contain_exactly(:status, :status_reason, :applications)
2018-03-17 18:26:18 +05:30
end
end
context 'when provider type is user' do
2020-05-24 23:13:21 +05:30
it 'serializes attrs correctly' do
is_expected.to contain_exactly(:status, :status_reason, :applications)
2018-03-17 18:26:18 +05:30
end
end
end
end