summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2018-12-12 17:51:36 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2018-12-21 18:00:14 +0800
commit51ac77af9a9bd70297ae6dd8c0290c73a46d8bf8 (patch)
tree80f309b336f92f7d841129d67bcbbe93f9db45dd /spec/views
parent62d250ff666770f9807eec2199a7b208ea8b518a (diff)
downloadgitlab-ce-51ac77af9a9bd70297ae6dd8c0290c73a46d8bf8.tar.gz
Add date range to milestone changed emails
Also refactored issues and MRs to use the same email template file
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/notify/changed_milestone_email.html.haml_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/views/notify/changed_milestone_email.html.haml_spec.rb b/spec/views/notify/changed_milestone_email.html.haml_spec.rb
new file mode 100644
index 00000000000..194b58840a3
--- /dev/null
+++ b/spec/views/notify/changed_milestone_email.html.haml_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'notify/changed_milestone_email.html.haml' do
+ let(:milestone) { create(:milestone, title: 'some-milestone') }
+ let(:milestone_link) { milestone_url(milestone) }
+
+ before do
+ assign(:milestone, milestone)
+ assign(:milestone_url, milestone_link)
+ end
+
+ context 'milestone without start and due dates' do
+ it 'renders without date range' do
+ render
+
+ expect(rendered).to have_content('Milestone changed to some-milestone', exact: true)
+ expect(rendered).to have_link('some-milestone', href: milestone_link)
+ end
+ end
+
+ context 'milestone with start and due dates' do
+ before do
+ milestone.update(start_date: '2018-01-01', due_date: '2018-12-31')
+ end
+
+ it 'renders with date range' do
+ render
+
+ expect(rendered).to have_content('Milestone changed to some-milestone (Jan 1, 2018–Dec 31, 2018)', exact: true)
+ expect(rendered).to have_link('some-milestone', href: milestone_link)
+ end
+ end
+end