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-10-07 15:06:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-07 15:06:18 +0300
commit185f428fa5e6123ffa0f29e307523da138e7b028 (patch)
tree1d5bb1d4700c0953aed2ad0e5d3515cc7935e550 /spec
parentab2382923e7a864a3fa27fdf8eeb9b21893b9147 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/emails/auto_reply.eml2
-rw-r--r--spec/fixtures/emails/auto_submitted.eml21
-rw-r--r--spec/lib/gitlab/email/receiver_spec.rb10
-rw-r--r--spec/support/shared_examples/cycle_analytics_stage_examples.rb7
-rw-r--r--spec/tasks/gitlab/cleanup_rake_spec.rb68
5 files changed, 38 insertions, 70 deletions
diff --git a/spec/fixtures/emails/auto_reply.eml b/spec/fixtures/emails/auto_reply.eml
index 7999c8d78b7..4d5a45df467 100644
--- a/spec/fixtures/emails/auto_reply.eml
+++ b/spec/fixtures/emails/auto_reply.eml
@@ -12,7 +12,7 @@ Mime-Version: 1.0
Content-Type: text/plain;
charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
-Auto-Submitted: auto-generated
+X-Autoreply: yes
X-Sieve: CMU Sieve 2.2
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
13 Jun 2013 14:03:48 -0700 (PDT)
diff --git a/spec/fixtures/emails/auto_submitted.eml b/spec/fixtures/emails/auto_submitted.eml
new file mode 100644
index 00000000000..7999c8d78b7
--- /dev/null
+++ b/spec/fixtures/emails/auto_submitted.eml
@@ -0,0 +1,21 @@
+Return-Path: <jake@adventuretime.ooo>
+Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
+Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <reply+59d8df8370b7e95c5a49fbf86aeb2c93@discourse.example.com>; Thu, 13 Jun 2013 17:03:50 -0400
+Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <reply+59d8df8370b7e95c5a49fbf86aeb2c93@discourse.example.com>; Thu, 13 Jun 2013 14:03:48 -0700
+Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
+Date: Thu, 13 Jun 2013 17:03:48 -0400
+From: Jake the Dog <jake@adventuretime.ooo>
+To: reply+636ca428858779856c226bb145ef4fad@appmail.adventuretime.ooo
+Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
+Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
+Mime-Version: 1.0
+Content-Type: text/plain;
+ charset=ISO-8859-1
+Content-Transfer-Encoding: 7bit
+Auto-Submitted: auto-generated
+X-Sieve: CMU Sieve 2.2
+X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
+ 13 Jun 2013 14:03:48 -0700 (PDT)
+X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
+
+Test reply to Discourse email digest
diff --git a/spec/lib/gitlab/email/receiver_spec.rb b/spec/lib/gitlab/email/receiver_spec.rb
index 6b5a355e598..43c73242f5f 100644
--- a/spec/lib/gitlab/email/receiver_spec.rb
+++ b/spec/lib/gitlab/email/receiver_spec.rb
@@ -40,7 +40,15 @@ describe Gitlab::Email::Receiver do
end
end
- context "when the email was auto generated" do
+ context "when the email was auto generated with Auto-Submitted header" do
+ let(:email_raw) { fixture_file("emails/auto_submitted.eml") }
+
+ it "raises an AutoGeneratedEmailError" do
+ expect { receiver.execute }.to raise_error(Gitlab::Email::AutoGeneratedEmailError)
+ end
+ end
+
+ context "when the email was auto generated with X-Autoreply header" do
let(:email_raw) { fixture_file("emails/auto_reply.eml") }
it "raises an AutoGeneratedEmailError" do
diff --git a/spec/support/shared_examples/cycle_analytics_stage_examples.rb b/spec/support/shared_examples/cycle_analytics_stage_examples.rb
index 151f5325e84..dc2ea229171 100644
--- a/spec/support/shared_examples/cycle_analytics_stage_examples.rb
+++ b/spec/support/shared_examples/cycle_analytics_stage_examples.rb
@@ -46,6 +46,13 @@ shared_examples_for 'cycle analytics stage' do
expect(stage).not_to be_valid
expect(stage.errors.details[:end_event]).to eq([{ error: :not_allowed_for_the_given_start_event }])
end
+
+ context 'disallows default stage names when creating custom stage' do
+ let(:invalid_params) { valid_params.merge(name: Gitlab::Analytics::CycleAnalytics::DefaultStages.names.first, custom: true) }
+ let(:stage) { described_class.new(invalid_params) }
+
+ it { expect(stage).not_to be_valid }
+ end
end
describe '#subject_model' do
diff --git a/spec/tasks/gitlab/cleanup_rake_spec.rb b/spec/tasks/gitlab/cleanup_rake_spec.rb
index 4aee6d005a8..6c09bb5d9f9 100644
--- a/spec/tasks/gitlab/cleanup_rake_spec.rb
+++ b/spec/tasks/gitlab/cleanup_rake_spec.rb
@@ -5,74 +5,6 @@ describe 'gitlab:cleanup rake tasks' do
Rake.application.rake_require 'tasks/gitlab/cleanup'
end
- describe 'cleanup namespaces and repos' do
- let(:gitlab_shell) { Gitlab::Shell.new }
- let(:storage) { storages.keys.first }
- let(:storages) do
- {
- 'default' => Gitlab::GitalyClient::StorageSettings.new(@default_storage_hash.merge('path' => 'tmp/tests/default_storage'))
- }
- end
-
- before(:all) do
- @default_storage_hash = Gitlab.config.repositories.storages.default.to_h
- end
-
- before do
- allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
- end
-
- after do
- Gitlab::GitalyClient::StorageService.new(storage).delete_all_repositories
- end
-
- describe 'cleanup:repos' do
- before do
- gitlab_shell.add_namespace(storage, 'broken/project.git')
- gitlab_shell.add_namespace(storage, '@hashed/12/34/5678.git')
- end
-
- it 'moves it to an orphaned path' do
- now = Time.now
-
- Timecop.freeze(now) do
- run_rake_task('gitlab:cleanup:repos')
- repo_list = Gitlab::GitalyClient::StorageService.new(storage).list_directories(depth: 0)
-
- expect(repo_list.last).to include("broken+orphaned+#{now.to_i}")
- end
- end
-
- it 'ignores @hashed repos' do
- run_rake_task('gitlab:cleanup:repos')
-
- expect(gitlab_shell.exists?(storage, '@hashed/12/34/5678.git')).to be(true)
- end
- end
-
- describe 'cleanup:dirs' do
- it 'removes missing namespaces' do
- gitlab_shell.add_namespace(storage, "namespace_1/project.git")
- gitlab_shell.add_namespace(storage, "namespace_2/project.git")
- allow(Namespace).to receive(:pluck).and_return(['namespace_1'])
-
- stub_env('REMOVE', 'true')
- run_rake_task('gitlab:cleanup:dirs')
-
- expect(gitlab_shell.exists?(storage, 'namespace_1')).to be(true)
- expect(gitlab_shell.exists?(storage, 'namespace_2')).to be(false)
- end
-
- it 'ignores @hashed directory' do
- gitlab_shell.add_namespace(storage, '@hashed/12/34/5678.git')
-
- run_rake_task('gitlab:cleanup:dirs')
-
- expect(gitlab_shell.exists?(storage, '@hashed/12/34/5678.git')).to be(true)
- end
- end
- end
-
# A single integration test that is redundant with one part of the
# Gitlab::Cleanup::ProjectUploads spec.
#