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:
authorDouwe Maan <douwe@gitlab.com>2015-02-25 17:49:40 +0300
committerDouwe Maan <douwe@gitlab.com>2015-02-25 17:51:13 +0300
commit969de4c15a876ab9096f163ef6182571ca199492 (patch)
treef6e493aa98c5fa80fe6bb8e30102a1b84f7a77f6 /spec/mailers
parent5d86332153838252384f9f87a0ae3e34c46eb266 (diff)
Fix EmailsOnPush to allow sending from @company.com for GitLab at gitlab.corp.company.com.
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/notify_spec.rb29
1 files changed, 25 insertions, 4 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 9af17942612..534ab05942c 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -607,11 +607,14 @@ describe Notify do
let(:send_from_committer_email) { true }
- context "when the committer email domain matches" do
+ before do
+ allow(Gitlab.config.gitlab).to receive(:host).and_return("gitlab.corp.company.com")
+ end
+
+ context "when the committer email domain is within the GitLab domain" do
before do
- allow(Gitlab.config.gitlab).to receive(:host).and_return("gitlab.dev")
- user.update_attribute(:email, "user@#{Gitlab.config.gitlab.host}")
+ user.update_attribute(:email, "user@company.com")
user.confirm!
end
@@ -621,7 +624,25 @@ describe Notify do
end
end
- context "when the committer email doesn't match" do
+ context "when the committer email domain is not completely within the GitLab domain" do
+
+ before do
+ user.update_attribute(:email, "user@something.company.com")
+ user.confirm!
+ end
+
+ it "is sent from the default email" do
+ sender = subject.header[:from].addrs[0]
+ expect(sender.address).to eq(gitlab_sender)
+ end
+ end
+
+ context "when the committer email domain is outside the GitLab domain" do
+
+ before do
+ user.update_attribute(:email, "user@mpany.com")
+ user.confirm!
+ end
it "is sent from the default email" do
sender = subject.header[:from].addrs[0]