summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-27 15:09:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-27 15:09:24 +0000
commitf8d15ca65390475e356b06dedc51e10ccd179f86 (patch)
treeef916d4e8e11c9e00d809e5cdcf63814e86d6e89 /spec/serializers
parent3ab4feda4dce9c9f0672375ae27c2f7c2ba6f4ad (diff)
downloadgitlab-ce-f8d15ca65390475e356b06dedc51e10ccd179f86.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/cluster_application_entity_spec.rb18
-rw-r--r--spec/serializers/merge_request_widget_entity_spec.rb20
-rw-r--r--spec/serializers/serverless/domain_entity_spec.rb19
3 files changed, 57 insertions, 0 deletions
diff --git a/spec/serializers/cluster_application_entity_spec.rb b/spec/serializers/cluster_application_entity_spec.rb
index c700c150461..873fbf812cc 100644
--- a/spec/serializers/cluster_application_entity_spec.rb
+++ b/spec/serializers/cluster_application_entity_spec.rb
@@ -59,5 +59,23 @@ describe ClusterApplicationEntity do
expect(subject[:external_ip]).to eq('111.222.111.222')
end
end
+
+ context 'for knative application' do
+ let(:pages_domain) { create(:pages_domain, :instance_serverless) }
+ let(:application) { build(:clusters_applications_knative, :installed) }
+
+ before do
+ create(:serverless_domain_cluster, knative: application, pages_domain: pages_domain)
+ end
+
+ it 'includes available domains' do
+ expect(subject[:available_domains].length).to eq(1)
+ expect(subject[:available_domains].first).to eq(id: pages_domain.id, domain: pages_domain.domain)
+ end
+
+ it 'includes pages_domain' do
+ expect(subject[:pages_domain]).to eq(id: pages_domain.id, domain: pages_domain.domain)
+ end
+ end
end
end
diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb
index 597dae81cfb..beb6a0de0f6 100644
--- a/spec/serializers/merge_request_widget_entity_spec.rb
+++ b/spec/serializers/merge_request_widget_entity_spec.rb
@@ -123,6 +123,26 @@ describe MergeRequestWidgetEntity do
expect(subject[:merge_request_add_ci_config_path]).not_to be_nil
end
end
+
+ context 'when build feature is disabled' do
+ before do
+ project.project_feature.update(builds_access_level: ProjectFeature::DISABLED)
+ end
+
+ it 'has no path' do
+ expect(subject[:merge_request_add_ci_config_path]).to be_nil
+ end
+ end
+
+ context 'when creating the pipeline is not allowed' do
+ before do
+ user.state = 'blocked'
+ end
+
+ it 'has no path' do
+ expect(subject[:merge_request_add_ci_config_path]).to be_nil
+ end
+ end
end
context 'when user does not have permissions' do
diff --git a/spec/serializers/serverless/domain_entity_spec.rb b/spec/serializers/serverless/domain_entity_spec.rb
new file mode 100644
index 00000000000..bdf0ccb176c
--- /dev/null
+++ b/spec/serializers/serverless/domain_entity_spec.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Serverless::DomainEntity do
+ describe '#as_json' do
+ let(:domain) { create(:pages_domain, :instance_serverless) }
+
+ subject { described_class.new(domain).as_json }
+
+ it 'has an id' do
+ expect(subject[:id]).to eq(domain.id)
+ end
+
+ it 'has a domain' do
+ expect(subject[:domain]).to eq(domain.domain)
+ end
+ end
+end