gitlab-org--gitlab-foss/spec/views/notify/changed_milestone_email.html.haml_spec.rb
Heinrich Lee Yu 51ac77af9a Add date range to milestone changed emails
Also refactored issues and MRs to use the same email template file
2018-12-21 18:00:14 +08:00

35 lines
1,022 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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, 2018Dec 31, 2018)', exact: true)
expect(rendered).to have_link('some-milestone', href: milestone_link)
end
end
end