diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-02-25 15:49:40 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-02-25 15:51:13 +0100 |
commit | 969de4c15a876ab9096f163ef6182571ca199492 (patch) | |
tree | f6e493aa98c5fa80fe6bb8e30102a1b84f7a77f6 /spec/mailers | |
parent | 5d86332153838252384f9f87a0ae3e34c46eb266 (diff) | |
download | gitlab-ce-969de4c15a876ab9096f163ef6182571ca199492.tar.gz |
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.rb | 29 |
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] |