gitlab-org--gitlab-foss/spec/serializers/cluster_serializer_spec.rb

47 lines
1.2 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-10-04 16:32:03 -04:00
require 'spec_helper'
RSpec.describe ClusterSerializer do
let(:cluster) { create(:cluster, :project, provider_type: :user) }
describe '#represent_list' do
subject { described_class.new(current_user: nil).represent_list(cluster).keys }
it 'serializes attrs correctly' do
is_expected.to contain_exactly(
:cluster_type,
:enabled,
:environment_scope,
:gitlab_managed_apps_logs_path,
:name,
:nodes,
:path,
:provider_type,
:status)
end
end
2017-10-04 16:32:03 -04:00
describe '#represent_status' do
subject { described_class.new(current_user: nil).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)
2017-10-30 12:03:58 -04:00
create(:cluster, provider_type: :gcp, provider_gcp: errored_provider)
end
2017-10-30 12:03:58 -04:00
it 'serializes attrs correctly' do
is_expected.to contain_exactly(:status, :status_reason, :applications)
2017-10-30 12:03:58 -04:00
end
end
2017-10-04 16:32:03 -04:00
2017-10-30 12:03:58 -04:00
context 'when provider type is user' do
it 'serializes attrs correctly' do
is_expected.to contain_exactly(:status, :status_reason, :applications)
2017-10-04 16:32:03 -04:00
end
end
end
end