Skip to content

Commit

Permalink
Merge pull request #2080 from sparc-request/saw-mailer-spec-fixes
Browse files Browse the repository at this point in the history
SAW - Mailer specs fixed
  • Loading branch information
Stuart-Johnson committed Dec 5, 2019
2 parents 8796d39 + 1aaeca1 commit 02f51c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/support/emails/tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

module EmailHelpers
include ApplicationHelper
include ActionView::Helpers::TagHelper
include ActionView::Context

def assert_email_project_information(mail_response)
#assert correct protocol information is included in notification email
Expand Down Expand Up @@ -178,7 +180,9 @@ def assert_email_note_information(mail)
expect(mail).to have_xpath "//th[text()='#{I18n.t(:notifier)[:note_user]}']/following-sibling::th[text()='#{I18n.t(:notifier)[:note_date]}']/following-sibling::th[text()='#{I18n.t(:notifier)[:note]}']"

@protocol.notes.each do |note|
expect(mail).to have_xpath "//td[text()=\"#{note.identity.full_name}\"]/following-sibling::td[text()='#{format_date(note.created_at)}']/following-sibling::td[text()='#{note.body}']"
expect(mail).to have_xpath "//td[text()=\"#{note.identity.full_name}\"]"
expect(mail).to have_xpath "//td/span[text()='#{ActionController::Base.helpers.strip_tags(format_date(note.created_at))}']"
expect(mail).to have_xpath "//td[text()='#{note.body}']"
end
else
expect(mail).to_not have_xpath "//table//th[text()='#{I18n.t('notifier.protocol_notes', type: @protocol.type)}']"
Expand Down

0 comments on commit 02f51c6

Please sign in to comment.