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>2019-11-13 18:07:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-13 18:07:29 +0300
commit3318518149062e5d17105f2170bd7bd9647af415 (patch)
treea2e49b8fea4543717ca006e9d06bdc032d5d4281 /spec
parent4e516dbff9767a35677fdc4a6e39005b4b564376 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml1
-rw-r--r--spec/models/clusters/applications/ingress_spec.rb12
-rw-r--r--spec/models/concerns/noteable_spec.rb44
-rw-r--r--spec/models/project_spec.rb37
-rw-r--r--spec/requests/api/merge_requests_spec.rb20
-rw-r--r--spec/requests/api/settings_spec.rb3
6 files changed, 53 insertions, 64 deletions
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 8bad40c629b..7d5206835c3 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -120,6 +120,7 @@ merge_requests:
- pipelines_for_merge_request
- merge_request_assignees
- suggestions
+- unresolved_notes
- assignees
- reviews
- approval_rules
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb
index 60b139a7610..d7ad7867e1a 100644
--- a/spec/models/clusters/applications/ingress_spec.rb
+++ b/spec/models/clusters/applications/ingress_spec.rb
@@ -165,6 +165,12 @@ describe Clusters::Applications::Ingress do
expect(subject.values).to include('extraVolumes')
expect(subject.values).to include('extraVolumeMounts')
end
+
+ it 'includes modsecurity sidecar container' do
+ expect(subject.values).to include('modsecurity-log-volume')
+
+ expect(subject.values).to include('extraContainers')
+ end
end
context 'when ingress_modsecurity is disabled' do
@@ -190,6 +196,12 @@ describe Clusters::Applications::Ingress do
expect(subject.values).not_to include('extraVolumes')
expect(subject.values).not_to include('extraVolumeMounts')
end
+
+ it 'excludes modsecurity sidecar container' do
+ expect(subject.values).not_to include('modsecurity-log-volume')
+
+ expect(subject.values).not_to include('extraContainers')
+ end
end
end
end
diff --git a/spec/models/concerns/noteable_spec.rb b/spec/models/concerns/noteable_spec.rb
index f823ac0165f..e8991a3a015 100644
--- a/spec/models/concerns/noteable_spec.rb
+++ b/spec/models/concerns/noteable_spec.rb
@@ -177,50 +177,6 @@ describe Noteable do
end
end
- describe "#discussions_to_be_resolved?" do
- context "when discussions are not resolvable" do
- before do
- allow(subject).to receive(:discussions_resolvable?).and_return(false)
- end
-
- it "returns false" do
- expect(subject.discussions_to_be_resolved?).to be false
- end
- end
-
- context "when discussions are resolvable" do
- before do
- allow(subject).to receive(:discussions_resolvable?).and_return(true)
-
- allow(first_discussion).to receive(:resolvable?).and_return(true)
- allow(second_discussion).to receive(:resolvable?).and_return(false)
- allow(third_discussion).to receive(:resolvable?).and_return(true)
- end
-
- context "when all resolvable discussions are resolved" do
- before do
- allow(first_discussion).to receive(:resolved?).and_return(true)
- allow(third_discussion).to receive(:resolved?).and_return(true)
- end
-
- it "returns false" do
- expect(subject.discussions_to_be_resolved?).to be false
- end
- end
-
- context "when some resolvable discussions are not resolved" do
- before do
- allow(first_discussion).to receive(:resolved?).and_return(true)
- allow(third_discussion).to receive(:resolved?).and_return(false)
- end
-
- it "returns true" do
- expect(subject.discussions_to_be_resolved?).to be true
- end
- end
- end
- end
-
describe "#discussions_to_be_resolved" do
before do
allow(first_discussion).to receive(:to_be_resolved?).and_return(true)
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 052651bdf50..0a64c70dccb 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2029,24 +2029,37 @@ describe Project do
end
describe '#ci_config_path=' do
- let(:project) { create(:project) }
+ using RSpec::Parameterized::TableSyntax
- it 'sets nil' do
- project.update!(ci_config_path: nil)
+ let(:project) { create(:project) }
- expect(project.ci_config_path).to be_nil
+ where(:default_ci_config_path, :project_ci_config_path, :expected_ci_config_path) do
+ nil | :notset | :default
+ nil | nil | :default
+ nil | '' | :default
+ nil | "cust\0om/\0/path" | 'custom//path'
+ '' | :notset | :default
+ '' | nil | :default
+ '' | '' | :default
+ '' | "cust\0om/\0/path" | 'custom//path'
+ 'global/path' | :notset | 'global/path'
+ 'global/path' | nil | :default
+ 'global/path' | '' | :default
+ 'global/path' | "cust\0om/\0/path" | 'custom//path'
end
- it 'sets a string' do
- project.update!(ci_config_path: 'foo/.gitlab_ci.yml')
-
- expect(project.ci_config_path).to eq('foo/.gitlab_ci.yml')
- end
+ with_them do
+ before do
+ stub_application_setting(default_ci_config_path: default_ci_config_path)
- it 'sets a string but removes all null characters' do
- project.update!(ci_config_path: "f\0oo/\0/.gitlab_ci.yml")
+ if project_ci_config_path != :notset
+ project.ci_config_path = project_ci_config_path
+ end
+ end
- expect(project.ci_config_path).to eq('foo//.gitlab_ci.yml')
+ it 'returns the correct path' do
+ expect(project.ci_config_path.presence || :default).to eq(expected_ci_config_path)
+ end
end
end
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 9ebddffe882..ddfe42129c0 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -701,16 +701,20 @@ describe API::MergeRequests do
expect(json_response.first['id']).to eq merge_request_closed.id
end
- it 'avoids N+1 queries' do
- control = ActiveRecord::QueryRecorder.new do
- get api("/projects/#{project.id}/merge_requests", user)
- end.count
+ context 'a project which enforces all discussions to be resolved' do
+ let!(:project) { create(:project, :repository, only_allow_merge_if_all_discussions_are_resolved: true) }
- create(:merge_request, author: user, assignees: [user], source_project: project, target_project: project, created_at: base_time)
+ it 'avoids N+1 queries' do
+ control = ActiveRecord::QueryRecorder.new do
+ get api("/projects/#{project.id}/merge_requests", user)
+ end.count
- expect do
- get api("/projects/#{project.id}/merge_requests", user)
- end.not_to exceed_query_limit(control)
+ create(:merge_request, author: user, assignees: [user], source_project: project, target_project: project, created_at: base_time)
+
+ expect do
+ get api("/projects/#{project.id}/merge_requests", user)
+ end.not_to exceed_query_limit(control)
+ end
end
end
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb
index c50cb4a5927..3190de03d1a 100644
--- a/spec/requests/api/settings_spec.rb
+++ b/spec/requests/api/settings_spec.rb
@@ -18,6 +18,7 @@ describe API::Settings, 'Settings' do
expect(json_response['password_authentication_enabled']).to be_truthy
expect(json_response['plantuml_enabled']).to be_falsey
expect(json_response['plantuml_url']).to be_nil
+ expect(json_response['default_ci_config_path']).to be_nil
expect(json_response['default_project_visibility']).to be_a String
expect(json_response['default_snippet_visibility']).to be_a String
expect(json_response['default_group_visibility']).to be_a String
@@ -49,6 +50,7 @@ describe API::Settings, 'Settings' do
it "updates application settings" do
put api("/application/settings", admin),
params: {
+ default_ci_config_path: 'debian/salsa-ci.yml',
default_projects_limit: 3,
default_project_creation: 2,
password_authentication_enabled_for_web: false,
@@ -80,6 +82,7 @@ describe API::Settings, 'Settings' do
}
expect(response).to have_gitlab_http_status(200)
+ expect(json_response['default_ci_config_path']).to eq('debian/salsa-ci.yml')
expect(json_response['default_projects_limit']).to eq(3)
expect(json_response['default_project_creation']).to eq(::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS)
expect(json_response['password_authentication_enabled_for_web']).to be_falsey