summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-07-26 14:51:52 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-07-26 14:51:52 +0800
commitb04f95a2edadd2f84bcecee59bf7001ff6362d00 (patch)
tree4c6ca2ce730f43668c68bbd11064f1af4cab31f8 /spec/workers
parentbd44f1419784ea98ad513f2f2f67ffeb94853c04 (diff)
parent68162ba900f1b9003fa3d07613333f201be8154a (diff)
downloadgitlab-ce-b04f95a2edadd2f84bcecee59bf7001ff6362d00.tar.gz
Merge remote-tracking branch 'upstream/master' into new-issue-by-email
* upstream/master: (620 commits) Added '*.js.es6 gitlab-language=javascript' to .gitattributes Fix CI status icon link underline Update CHANGELOG after 8.10.1 Add CHANGELOG Add es6 gem Instrument Nokogiri parsing methods Fix backup restore Use project ID in repository cache to prevent stale data from persisting across projects Add iid to MR API response `WikiPage` should have a slug even when not persisted. ES6ify all the things! Make fork counter always clickable (!5463) Revert "Merge branch '17073-tagscontroller-index-is-terrible-response-time-goes-up-to-5-…" Fix CHANGELOG Add spec for dashes in paths Fix Error 500 when creating Wiki pages with hyphens or spaces Add links to the real markdown.md file for all GFM examples Remove magic comments from Ruby files (!5456) Ignore invalid trusted proxies in X-Forwarded-For header remove search_id for label dropdown filter ...
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/emails_on_push_worker_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/workers/emails_on_push_worker_spec.rb b/spec/workers/emails_on_push_worker_spec.rb
index 439da765c2c..796751efe8d 100644
--- a/spec/workers/emails_on_push_worker_spec.rb
+++ b/spec/workers/emails_on_push_worker_spec.rb
@@ -12,6 +12,42 @@ describe EmailsOnPushWorker do
subject { EmailsOnPushWorker.new }
describe "#perform" do
+ context "when push is a new branch" do
+ let(:email) { ActionMailer::Base.deliveries.last }
+
+ before do
+ data_new_branch = data.stringify_keys.merge("before" => Gitlab::Git::BLANK_SHA)
+
+ subject.perform(project.id, recipients, data_new_branch)
+ end
+
+ it "sends a mail with the correct subject" do
+ expect(email.subject).to include("Pushed new branch")
+ end
+
+ it "sends the mail to the correct recipient" do
+ expect(email.to).to eq([user.email])
+ end
+ end
+
+ context "when push is a deleted branch" do
+ let(:email) { ActionMailer::Base.deliveries.last }
+
+ before do
+ data_deleted_branch = data.stringify_keys.merge("after" => Gitlab::Git::BLANK_SHA)
+
+ subject.perform(project.id, recipients, data_deleted_branch)
+ end
+
+ it "sends a mail with the correct subject" do
+ expect(email.subject).to include("Deleted branch")
+ end
+
+ it "sends the mail to the correct recipient" do
+ expect(email.to).to eq([user.email])
+ end
+ end
+
context "when there are no errors in sending" do
let(:email) { ActionMailer::Base.deliveries.last }