diff options
Diffstat (limited to 'test/unit/mailer_test.rb')
-rw-r--r-- | test/unit/mailer_test.rb | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index 5607d1636..97516c139 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -19,7 +19,7 @@ require File.expand_path('../../test_helper', __FILE__) class MailerTest < ActiveSupport::TestCase include Redmine::I18n - include ActionController::Assertions::SelectorAssertions + include ActionDispatch::Assertions::SelectorAssertions fixtures :projects, :enabled_modules, :issues, :users, :members, :member_roles, :roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, @@ -78,7 +78,6 @@ class MailerTest < ActiveSupport::TestCase relative_url_root = Redmine::Utils.relative_url_root Setting.host_name = 'mydomain.foo/rdm' Setting.protocol = 'http' - Redmine::Utils.relative_url_root = '/rdm' journal = Journal.find(3) assert Mailer.deliver_issue_edit(journal) @@ -111,9 +110,6 @@ class MailerTest < ActiveSupport::TestCase 'http://mydomain.foo/rdm/attachments/download/4/source.rb', :text => 'source.rb' end - ensure - # restore it - Redmine::Utils.relative_url_root = relative_url_root end def test_generated_links_with_prefix_and_no_relative_url_root @@ -164,15 +160,15 @@ class MailerTest < ActiveSupport::TestCase Mailer.deliver_issue_add(issue) mail = last_email assert_not_nil mail - assert_equal 'OOF', mail.header_string('X-Auto-Response-Suppress') - assert_equal 'auto-generated', mail.header_string('Auto-Submitted') + assert_equal 'OOF', mail.header['X-Auto-Response-Suppress'].to_s + assert_equal 'auto-generated', mail.header['Auto-Submitted'].to_s end def test_email_headers_should_include_sender issue = Issue.find(1) Mailer.deliver_issue_add(issue) mail = last_email - assert_equal issue.author.login, mail.header_string('X-Redmine-Sender') + assert_equal issue.author.login, mail.header['X-Redmine-Sender'].to_s end def test_plain_text_mail @@ -180,7 +176,7 @@ class MailerTest < ActiveSupport::TestCase journal = Journal.find(2) Mailer.deliver_issue_edit(journal) mail = last_email - assert_equal "text/plain", mail.content_type + assert_equal "text/plain; charset=UTF-8", mail.content_type assert_equal 0, mail.parts.size assert !mail.encoded.include?('href') end @@ -199,7 +195,7 @@ class MailerTest < ActiveSupport::TestCase Mailer.deliver_test_email(User.find(1)) end mail = last_email - assert_equal 'redmine@example.net', mail.from_addrs.first.address + assert_equal 'redmine@example.net', mail.from_addrs.first end def test_from_header_with_phrase @@ -207,8 +203,8 @@ class MailerTest < ActiveSupport::TestCase Mailer.deliver_test_email(User.find(1)) end mail = last_email - assert_equal 'redmine@example.net', mail.from_addrs.first.address - assert_equal 'Redmine app', mail.from_addrs.first.name + assert_equal 'redmine@example.net', mail.from_addrs.first + assert_equal 'Redmine app <redmine@example.net>', mail.header['From'].to_s end def test_should_not_send_email_without_recipient @@ -245,7 +241,7 @@ class MailerTest < ActiveSupport::TestCase Mailer.deliver_issue_edit(journal) mail = last_email assert_equal Mailer.message_id_for(journal), mail.message_id - assert_equal Mailer.message_id_for(journal.issue), mail.references.first.to_s + assert_include Mailer.message_id_for(journal.issue), mail.references assert_select_email do # link to the update assert_select "a[href=?]", @@ -272,7 +268,7 @@ class MailerTest < ActiveSupport::TestCase Mailer.deliver_message_posted(message) mail = last_email assert_equal Mailer.message_id_for(message), mail.message_id - assert_equal Mailer.message_id_for(message.parent), mail.references.first.to_s + assert_include Mailer.message_id_for(message.parent), mail.references assert_select_email do # link to the reply assert_select "a[href=?]", @@ -528,14 +524,6 @@ class MailerTest < ActiveSupport::TestCase # should restore perform_deliveries assert ActionMailer::Base.perform_deliveries end - - def test_tmail_to_header_field_should_not_include_blank_lines - mail = TMail::Mail.new - mail.to = ["a.user@example.com", "v.user2@example.com", "e.smith@example.com", "info@example.com", "v.pupkin@example.com", - "b.user@example.com", "w.user2@example.com", "f.smith@example.com", "info2@example.com", "w.pupkin@example.com"] - - assert !mail.encoded.strip.split("\r\n").detect(&:blank?), "#{mail.encoded} malformed" - end def test_layout_should_include_the_emails_header with_settings :emails_header => "*Header content*" do |