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>2020-01-21 06:08:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 06:08:37 +0300
commit2399724614f3c4dcf3059038d997193830de93ee (patch)
tree3315c4453ef3efb5c1162911753436cad4f3e57d /spec/lib/gitlab
parent6755df108b123ecc8ae330d7c7bf2f04fbf36a81 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/email/receiver_spec.rb8
-rw-r--r--spec/lib/gitlab/mail_room/mail_room_spec.rb34
-rw-r--r--spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb2
-rw-r--r--spec/lib/gitlab/untrusted_regexp_spec.rb2
4 files changed, 44 insertions, 2 deletions
diff --git a/spec/lib/gitlab/email/receiver_spec.rb b/spec/lib/gitlab/email/receiver_spec.rb
index 018219e5647..b764bb39682 100644
--- a/spec/lib/gitlab/email/receiver_spec.rb
+++ b/spec/lib/gitlab/email/receiver_spec.rb
@@ -5,6 +5,14 @@ require 'spec_helper'
describe Gitlab::Email::Receiver do
include_context :email_shared_context
+ shared_examples 'correctly finds the mail key' do
+ specify do
+ expect(Gitlab::Email::Handler).to receive(:for).with(an_instance_of(Mail::Message), 'gitlabhq/gitlabhq+auth_token').and_return(handler)
+
+ receiver.execute
+ end
+ end
+
context 'when the email contains a valid email address in a header' do
let(:handler) { double(:handler) }
diff --git a/spec/lib/gitlab/mail_room/mail_room_spec.rb b/spec/lib/gitlab/mail_room/mail_room_spec.rb
index cb3e214d38b..43218fc6e0d 100644
--- a/spec/lib/gitlab/mail_room/mail_room_spec.rb
+++ b/spec/lib/gitlab/mail_room/mail_room_spec.rb
@@ -16,6 +16,40 @@ describe Gitlab::MailRoom do
}
end
+ shared_examples_for 'only truthy if both enabled and address are truthy' do |target_proc|
+ context 'with both enabled and address as truthy values' do
+ it 'is truthy' do
+ stub_config(enabled: true, address: 'localhost')
+
+ expect(target_proc.call).to be_truthy
+ end
+ end
+
+ context 'with address only as truthy' do
+ it 'is falsey' do
+ stub_config(enabled: false, address: 'localhost')
+
+ expect(target_proc.call).to be_falsey
+ end
+ end
+
+ context 'with enabled only as truthy' do
+ it 'is falsey' do
+ stub_config(enabled: true, address: nil)
+
+ expect(target_proc.call).to be_falsey
+ end
+ end
+
+ context 'with neither address nor enabled as truthy' do
+ it 'is falsey' do
+ stub_config(enabled: false, address: nil)
+
+ expect(target_proc.call).to be_falsey
+ end
+ end
+ end
+
before do
described_class.reset_config!
allow(File).to receive(:exist?).and_return true
diff --git a/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb b/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb
index 68402e64012..cdd681a9345 100644
--- a/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb
+++ b/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'fast_spec_helper'
-require 'support/shared_examples/malicious_regexp_shared_examples'
+require 'support/shared_examples/lib/gitlab/malicious_regexp_shared_examples'
require 'support/helpers/stub_feature_flags'
describe Gitlab::UntrustedRegexp::RubySyntax do
diff --git a/spec/lib/gitlab/untrusted_regexp_spec.rb b/spec/lib/gitlab/untrusted_regexp_spec.rb
index 4cc21e94a83..60f14d0277b 100644
--- a/spec/lib/gitlab/untrusted_regexp_spec.rb
+++ b/spec/lib/gitlab/untrusted_regexp_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'fast_spec_helper'
-require 'support/shared_examples/malicious_regexp_shared_examples'
+require 'support/shared_examples/lib/gitlab/malicious_regexp_shared_examples'
describe Gitlab::UntrustedRegexp do
describe '#initialize' do