From b2e4d8ad3f36bcdfab735d8c4c2e68b810743c0d Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sat, 14 Nov 2009 19:40:56 +0000 Subject: [PATCH] Fixed some tests that where looking for specific issue urls but weren't matching the css classes for the link. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3049 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/helpers/application_helper_test.rb | 2 +- test/unit/mailer_test.rb | 47 +++++++++++--------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index f61f219ab..90eaed4f7 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -135,7 +135,7 @@ RAW def test_redmine_links issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, - :class => 'issue', :title => 'Error 281 when updating a recipe (New)') + :class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)') changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, :class => 'changeset', :title => 'My very first commit') diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index cc6e6cf3e..b8ff4f003 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -19,6 +19,7 @@ require File.dirname(__FILE__) + '/../test_helper' class MailerTest < ActiveSupport::TestCase include Redmine::I18n + include ActionController::Assertions::SelectorAssertions fixtures :projects, :issues, :users, :members, :member_roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories def test_generated_links_in_emails @@ -31,13 +32,15 @@ class MailerTest < ActiveSupport::TestCase mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail - # link to the main ticket - assert mail.body.include?('Bug #1: Can\'t print recipes') - # link to a referenced ticket - assert mail.body.include?('#2') - # link to a changeset - assert mail.body.include?('r2') + assert_select_email do + # link to the main ticket + assert_select "a[href=?]", "https://mydomain.foo/issues/1", :text => "Bug #1: Can't print recipes" + # link to a referenced ticket + assert_select "a[href=?][title=?]", "https://mydomain.foo/issues/2", "Add ingredients categories (Assigned)", :text => "#2" + # link to a changeset + assert_select "a[href=?][title=?]", "https://mydomain.foo/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2" + end end def test_generated_links_with_prefix @@ -52,13 +55,15 @@ class MailerTest < ActiveSupport::TestCase mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail - # link to the main ticket - assert mail.body.include?('Bug #1: Can\'t print recipes') - - # link to a referenced ticket - assert mail.body.include?('#2') - # link to a changeset - assert mail.body.include?('r2') + + assert_select_email do + # link to the main ticket + assert_select "a[href=?]", "http://mydomain.foo/rdm/issues/1", :text => "Bug #1: Can't print recipes" + # link to a referenced ticket + assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/issues/2", "Add ingredients categories (Assigned)", :text => "#2" + # link to a changeset + assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2" + end ensure # restore it Redmine::Utils.relative_url_root = relative_url_root @@ -76,13 +81,15 @@ class MailerTest < ActiveSupport::TestCase mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail - # link to the main ticket - assert mail.body.include?('Bug #1: Can\'t print recipes') - - # link to a referenced ticket - assert mail.body.include?('#2') - # link to a changeset - assert mail.body.include?('r2') + + assert_select_email do + # link to the main ticket + assert_select "a[href=?]", "http://mydomain.foo/rdm/issues/1", :text => "Bug #1: Can't print recipes" + # link to a referenced ticket + assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/issues/2", "Add ingredients categories (Assigned)", :text => "#2" + # link to a changeset + assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2" + end ensure # restore it Redmine::Utils.relative_url_root = relative_url_root -- 2.39.5