From 24070bac45134c915c13d3e94723a44f59ab4e3a Mon Sep 17 00:00:00 2001 From: hhoopes Date: Mon, 22 Aug 2016 23:36:30 -0600 Subject: Add new template to handle both commit & mr notes Currently comments on commits and merge requests do not require merge request- or commit-specific information, but can use the same template. Rather than change the method which calls the template, I opted to keep the templates separate and create a new template to highlight their identicality, while preserving the option to distinguish them from each other in the future. Also removed some of the inconsistencies between text and html email versions. Still needed is a text-only version of git diffs and testing. --- spec/mailers/notify_spec.rb | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'spec/mailers/notify_spec.rb') diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index b40a6b1cbac..932a5dc4862 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -580,10 +580,8 @@ describe Notify do let(:note_author) { create(:user, name: 'author_name') } let(:note) { create(:note, project: project, author: note_author) } - before do |example| - unless example.metadata[:skip_before] - allow(Note).to receive(:find).with(note.id).and_return(note) - end + before :each do + allow(Note).to receive(:find).with(note.id).and_return(note) end shared_examples 'a note email' do @@ -665,19 +663,6 @@ describe Notify do end end - describe "on a merge request with diffs", :skip_before do - let(:merge_request) { create(:merge_request_with_diffs) } - let(:note_with_diff) {create(:diff_note_on_merge_request)} - - before(:each) { allow(note_with_diff).to receive(:noteable).and_return(merge_request) } - subject { Notify.note_merge_request_email(recipient.id, note_with_diff.id) } - - it 'includes diffs with character-level highlighting' do - expected_line_text = Discussion.new([note_with_diff]).truncated_diff_lines.first.text - is_expected.to have_body_text expected_line_text - end - end - describe 'on an issue' do let(:issue) { create(:issue, project: project) } let(:note_on_issue_path) { namespace_project_issue_path(project.namespace, project, issue, anchor: "note_#{note.id}") } -- cgit v1.2.3