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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-25 21:11:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-25 21:11:05 +0300
commit01ae05ffd11edc648e94c44007fced664bc089ea (patch)
tree37eb766c034959910801f02faa957e63a4cc7227 /spec
parentc00ed910738a6db7db12fb9eb67ec318e6dabec5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/search_controller_spec.rb8
-rw-r--r--spec/finders/ci/daily_build_group_report_results_finder_spec.rb19
-rw-r--r--spec/services/issues/create_service_spec.rb6
-rw-r--r--spec/workers/namespaces/onboarding_issue_created_worker_spec.rb28
4 files changed, 61 insertions, 0 deletions
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index 7a5e5efedf1..32ac83847aa 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -252,6 +252,14 @@ RSpec.describe SearchController do
get :count, params: { search: 'hello' }
end.to raise_error(ActionController::ParameterMissing)
end
+
+ it 'sets private cache control headers' do
+ get :count, params: { search: 'hello', scope: 'projects' }
+
+ expect(response).to have_gitlab_http_status(:ok)
+
+ expect(response.headers['Cache-Control']).to include('max-age=60, private')
+ end
end
describe 'GET #autocomplete' do
diff --git a/spec/finders/ci/daily_build_group_report_results_finder_spec.rb b/spec/finders/ci/daily_build_group_report_results_finder_spec.rb
index ecfa66b07dc..cf15a00323b 100644
--- a/spec/finders/ci/daily_build_group_report_results_finder_spec.rb
+++ b/spec/finders/ci/daily_build_group_report_results_finder_spec.rb
@@ -79,6 +79,25 @@ RSpec.describe Ci::DailyBuildGroupReportResultsFinder do
])
end
end
+
+ context 'when provided dates are nil' do
+ let(:start_date) { nil }
+ let(:end_date) { nil }
+ let(:rspec_coverage_4) { create_daily_coverage('rspec', 98.0, 91.days.ago.to_date.to_s) }
+
+ it 'returns all coverages from the last 90 days' do
+ expect(coverages).to match_array(
+ [
+ karma_coverage_3,
+ rspec_coverage_3,
+ karma_coverage_2,
+ rspec_coverage_2,
+ karma_coverage_1,
+ rspec_coverage_1
+ ]
+ )
+ end
+ end
end
end
end
diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb
index e42e9722297..d548e5ee74a 100644
--- a/spec/services/issues/create_service_spec.rb
+++ b/spec/services/issues/create_service_spec.rb
@@ -286,6 +286,12 @@ RSpec.describe Issues::CreateService do
issue
end
+
+ it 'schedules a namespace onboarding create action worker' do
+ expect(Namespaces::OnboardingIssueCreatedWorker).to receive(:perform_async).with(project.namespace.id)
+
+ issue
+ end
end
context 'issue create service' do
diff --git a/spec/workers/namespaces/onboarding_issue_created_worker_spec.rb b/spec/workers/namespaces/onboarding_issue_created_worker_spec.rb
new file mode 100644
index 00000000000..459e4f953d0
--- /dev/null
+++ b/spec/workers/namespaces/onboarding_issue_created_worker_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Namespaces::OnboardingIssueCreatedWorker, '#perform' do
+ let_it_be(:issue) { create(:issue) }
+ let(:namespace) { issue.namespace }
+
+ it_behaves_like 'records an onboarding progress action', :issue_created do
+ subject { described_class.new.perform(namespace.id) }
+ end
+
+ it_behaves_like 'does not record an onboarding progress action' do
+ subject { described_class.new.perform(nil) }
+ end
+
+ it_behaves_like 'an idempotent worker' do
+ let(:job_args) { [namespace.id] }
+
+ it 'sets the onboarding progress action' do
+ OnboardingProgress.onboard(namespace)
+
+ subject
+
+ expect(OnboardingProgress.completed?(namespace, :issue_created)).to eq(true)
+ end
+ end
+end