Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-15 18:10:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-15 18:10:57 +0300
commite5c7d631a84940c66e46f1824ba7ce0c7f1d0ea4 (patch)
treeac1cce129d8c8cdcee6a668e27d8034d2da172e4 /spec/helpers
parent0687020509cafe1e24eb0bfa0e0f5c9f6c4799d2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/clusters_helper_spec.rb57
-rw-r--r--spec/helpers/routing/pseudonymization_helper_spec.rb25
2 files changed, 51 insertions, 31 deletions
diff --git a/spec/helpers/clusters_helper_spec.rb b/spec/helpers/clusters_helper_spec.rb
index 904151812e6..51f111917d1 100644
--- a/spec/helpers/clusters_helper_spec.rb
+++ b/spec/helpers/clusters_helper_spec.rb
@@ -59,35 +59,6 @@ RSpec.describe ClustersHelper do
end
end
- describe '#js_cluster_agents_list_data' do
- let_it_be(:project) { build(:project, :repository) }
-
- subject { helper.js_cluster_agents_list_data(project) }
-
- it 'displays project default branch' do
- expect(subject[:default_branch_name]).to eq(project.default_branch)
- end
-
- it 'displays image path' do
- expect(subject[:empty_state_image]).to match(%r(/illustrations/empty-state/empty-state-agents|svg))
- end
-
- it 'displays project path' do
- expect(subject[:project_path]).to eq(project.full_path)
- end
-
- it 'generates docs urls' do
- expect(subject[:multiple_clusters_docs_url]).to eq(help_page_path('user/project/clusters/multiple_kubernetes_clusters'))
- expect(subject[:install_docs_url]).to eq(help_page_path('administration/clusters/kas'))
- expect(subject[:get_started_docs_url]).to eq(help_page_path('user/clusters/agent/index', anchor: 'define-a-configuration-repository'))
- expect(subject[:integration_docs_url]).to eq(help_page_path('user/clusters/agent/index', anchor: 'get-started-with-gitops-and-the-gitlab-agent'))
- end
-
- it 'displays kas address' do
- expect(subject[:kas_address]).to eq(Gitlab::Kas.external_url)
- end
- end
-
describe '#js_clusters_list_data' do
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { build(:project) }
@@ -153,6 +124,34 @@ RSpec.describe ClustersHelper do
end
end
+ describe '#js_clusters_data' do
+ let_it_be(:current_user) { create(:user) }
+ let_it_be(:project) { build(:project) }
+ let_it_be(:clusterable) { ClusterablePresenter.fabricate(project, current_user: current_user) }
+
+ subject { helper.js_clusters_data(clusterable) }
+
+ it 'displays project default branch' do
+ expect(subject[:default_branch_name]).to eq(project.default_branch)
+ end
+
+ it 'displays image path' do
+ expect(subject[:empty_state_image]).to match(%r(/illustrations/empty-state/empty-state-agents|svg))
+ end
+
+ it 'displays project path' do
+ expect(subject[:project_path]).to eq(project.full_path)
+ end
+
+ it 'displays add cluster using certificate path' do
+ expect(subject[:add_cluster_path]).to eq("#{project_path(project)}/-/clusters/new?tab=add")
+ end
+
+ it 'displays kas address' do
+ expect(subject[:kas_address]).to eq(Gitlab::Kas.external_url)
+ end
+ end
+
describe '#js_cluster_new' do
subject { helper.js_cluster_new }
diff --git a/spec/helpers/routing/pseudonymization_helper_spec.rb b/spec/helpers/routing/pseudonymization_helper_spec.rb
index e41e62a4fe2..82ed893289d 100644
--- a/spec/helpers/routing/pseudonymization_helper_spec.rb
+++ b/spec/helpers/routing/pseudonymization_helper_spec.rb
@@ -160,7 +160,7 @@ RSpec.describe ::Routing::PseudonymizationHelper do
end
context 'when author_username is present' do
- let(:masked_url) { "http://localhost/dashboard/issues?author_username=masked_author_username&scope=all&state=opened" }
+ let(:masked_url) { "http://localhost/dashboard/issues?author_username=masked_author_username&scope=masked_scope&state=masked_state" }
let(:request) do
double(:Request,
path_parameters: {
@@ -179,8 +179,29 @@ RSpec.describe ::Routing::PseudonymizationHelper do
it_behaves_like 'masked url'
end
+ context 'when some query params are not required to be masked' do
+ let(:masked_url) { "http://localhost/dashboard/issues?author_username=masked_author_username&scope=all&state=masked_state" }
+ let(:request) do
+ double(:Request,
+ path_parameters: {
+ controller: 'dashboard',
+ action: 'issues'
+ },
+ protocol: 'http',
+ host: 'localhost',
+ query_string: 'author_username=root&scope=all&state=opened')
+ end
+
+ before do
+ stub_const('Routing::PseudonymizationHelper::MaskHelper::QUERY_PARAMS_TO_NOT_MASK', %w[scope].freeze)
+ allow(helper).to receive(:request).and_return(request)
+ end
+
+ it_behaves_like 'masked url'
+ end
+
context 'when query string has keys with the same names as path params' do
- let(:masked_url) { "http://localhost/dashboard/issues?action=foobar&scope=all&state=opened" }
+ let(:masked_url) { "http://localhost/dashboard/issues?action=masked_action&scope=masked_scope&state=masked_state" }
let(:request) do
double(:Request,
path_parameters: {