summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-17 17:02:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-17 17:02:55 +0000
commitd85f73a30d48b3472346fb712106e6d5f4403278 (patch)
tree35d9205b3bf1da3c4e1cc9fc7699f798395d4702 /test/unit
parent3ea8b706978b490fc54cde8e14dcde2a748dec1a (diff)
downloadredmine-d85f73a30d48b3472346fb712106e6d5f4403278.tar.gz
redmine-d85f73a30d48b3472346fb712106e6d5f4403278.zip
Upgrade to Rails 4.2.0 (#14534).
git-svn-id: http://svn.redmine.org/redmine/trunk@13892 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/helpers/application_helper_test.rb13
-rw-r--r--test/unit/helpers/groups_helper_test.rb2
-rw-r--r--test/unit/helpers/members_helper_test.rb2
-rw-r--r--test/unit/helpers/projects_helper_test.rb4
-rw-r--r--test/unit/lib/redmine/helpers/gantt_test.rb40
-rw-r--r--test/unit/lib/redmine/menu_manager/menu_helper_test.rb4
-rw-r--r--test/unit/mailer_test.rb33
7 files changed, 52 insertions, 46 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 7512f1fe5..1ed964d5e 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -1217,15 +1217,15 @@ RAW
result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "")
# heading that contains inline code
- assert_match Regexp.new('<div class="contextual" id="section-4" title="Edit this section">' +
- '<a href="/projects/1/wiki/Test/edit\?section=4"><img alt="Edit" src="/images/edit.png(\?\d+)?" /></a></div>' +
+ assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-4">' +
+ '<a href="/projects/1/wiki/Test/edit\?section=4"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' +
'<a name="Subtitle-with-inline-code"></a>' +
'<h2 >Subtitle with <code>inline code</code><a href="#Subtitle-with-inline-code" class="wiki-anchor">&para;</a></h2>'),
result
# last heading
- assert_match Regexp.new('<div class="contextual" id="section-5" title="Edit this section">' +
- '<a href="/projects/1/wiki/Test/edit\?section=5"><img alt="Edit" src="/images/edit.png(\?\d+)?" /></a></div>' +
+ assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-5">' +
+ '<a href="/projects/1/wiki/Test/edit\?section=5"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' +
'<a name="Subtitle-after-pre-tag"></a>' +
'<h2 >Subtitle after pre tag<a href="#Subtitle-after-pre-tag" class="wiki-anchor">&para;</a></h2>'),
result
@@ -1323,8 +1323,9 @@ RAW
def test_thumbnail_tag
a = Attachment.find(3)
- assert_equal '<a href="/attachments/3/logo.gif" title="logo.gif"><img alt="3" src="/attachments/thumbnail/3" /></a>',
- thumbnail_tag(a)
+ assert_select_in thumbnail_tag(a),
+ 'a[href=?][title=?] img[alt="3"][src=?]',
+ "/attachments/3/logo.gif", "logo.gif", "/attachments/thumbnail/3"
end
def test_link_to_project
diff --git a/test/unit/helpers/groups_helper_test.rb b/test/unit/helpers/groups_helper_test.rb
index 177287305..19a08134e 100644
--- a/test/unit/helpers/groups_helper_test.rb
+++ b/test/unit/helpers/groups_helper_test.rb
@@ -28,7 +28,7 @@ class GroupsHelperTest < ActionView::TestCase
group = Group.generate!
result = render_principals_for_new_group_users(group)
- assert_select_in result, 'input[name=?][value=2]', 'user_ids[]'
+ assert_select_in result, 'input[name=?][value="2"]', 'user_ids[]'
end
def test_render_principals_for_new_group_users_with_limited_results_should_paginate
diff --git a/test/unit/helpers/members_helper_test.rb b/test/unit/helpers/members_helper_test.rb
index b8154914a..0c20aa4e7 100644
--- a/test/unit/helpers/members_helper_test.rb
+++ b/test/unit/helpers/members_helper_test.rb
@@ -29,7 +29,7 @@ class MembersHelperTest < ActionView::TestCase
project = Project.generate!
result = render_principals_for_new_members(project)
- assert_select_in result, 'input[name=?][value=2]', 'membership[user_ids][]'
+ assert_select_in result, 'input[name=?][value="2"]', 'membership[user_ids][]'
end
def test_render_principals_for_new_members_with_limited_results_should_paginate
diff --git a/test/unit/helpers/projects_helper_test.rb b/test/unit/helpers/projects_helper_test.rb
index 6f3b143d9..713384527 100644
--- a/test/unit/helpers/projects_helper_test.rb
+++ b/test/unit/helpers/projects_helper_test.rb
@@ -42,12 +42,12 @@ class ProjectsHelperTest < ActionView::TestCase
def test_link_to_version_within_project
@project = Project.find(2)
User.current = User.find(1)
- assert_equal '<a href="/versions/5" title="07/01/2006">Alpha</a>', link_to_version(Version.find(5))
+ assert_equal '<a title="07/01/2006" href="/versions/5">Alpha</a>', link_to_version(Version.find(5))
end
def test_link_to_version
User.current = User.find(1)
- assert_equal '<a href="/versions/5" title="07/01/2006">Alpha</a>', link_to_version(Version.find(5))
+ assert_equal '<a title="07/01/2006" href="/versions/5">Alpha</a>', link_to_version(Version.find(5))
end
def test_link_to_version_without_effective_date
diff --git a/test/unit/lib/redmine/helpers/gantt_test.rb b/test/unit/lib/redmine/helpers/gantt_test.rb
index ae8b96c9b..d96f01651 100644
--- a/test/unit/lib/redmine/helpers/gantt_test.rb
+++ b/test/unit/lib/redmine/helpers/gantt_test.rb
@@ -128,14 +128,14 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
setup_subjects
@output_buffer = @gantt.subjects
assert_select "div.project-name a", /#{@project.name}/
- assert_select "div.project-name[style*=left:4px]"
+ assert_select 'div.project-name[style*="left:4px"]'
end
test "#subjects version should be rendered" do
setup_subjects
@output_buffer = @gantt.subjects
assert_select "div.version-name a", /#{@version.name}/
- assert_select "div.version-name[style*=left:24px]"
+ assert_select 'div.version-name[style*="left:24px"]'
end
test "#subjects version without assigned issues should not be rendered" do
@@ -152,7 +152,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
setup_subjects
@output_buffer = @gantt.subjects
assert_select "div.issue-subject", /#{@issue.subject}/
- assert_select "div.issue-subject[style*=left:44px]"
+ assert_select 'div.issue-subject[style*="left:44px"]'
end
test "#subjects issue assigned to a shared version of another project should be rendered" do
@@ -197,12 +197,12 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
)
@output_buffer = @gantt.subjects
# parent task 44px
- assert_select "div.issue-subject[style*=left:44px]", /#{@issue.subject}/
+ assert_select 'div.issue-subject[style*="left:44px"]', /#{@issue.subject}/
# children 64px
- assert_select "div.issue-subject[style*=left:64px]", /child1/
- assert_select "div.issue-subject[style*=left:64px]", /child2/
+ assert_select 'div.issue-subject[style*="left:64px"]', /child1/
+ assert_select 'div.issue-subject[style*="left:64px"]', /child2/
# grandchild 84px
- assert_select "div.issue-subject[style*=left:84px]", /grandchild/, @output_buffer
+ assert_select 'div.issue-subject[style*="left:84px"]', /grandchild/, @output_buffer
end
test "#lines" do
@@ -298,7 +298,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
test "#subject should use the indent option to move the div to the right" do
create_gantt
@output_buffer = @gantt.subject('subject', :format => :html, :indent => 40)
- assert_select "div[style*=left:40]"
+ assert_select 'div[style*="left:40"]'
end
test "#line_for_project" do
@@ -332,65 +332,65 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
test "#line todo line should start from the starting point on the left" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
- assert_select "div.task_todo[style*=left:28px]", 1
+ assert_select 'div.task_todo[style*="left:28px"]', 1
end
test "#line todo line should be the total width" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
- assert_select "div.task_todo[style*=width:58px]", 1
+ assert_select 'div.task_todo[style*="width:58px"]', 1
end
test "#line late line should start from the starting point on the left" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
- assert_select "div.task_late[style*=left:28px]", 1
+ assert_select 'div.task_late[style*="left:28px"]', 1
end
test "#line late line should be the total delayed width" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
- assert_select "div.task_late[style*=width:30px]", 1
+ assert_select 'div.task_late[style*="width:30px"]', 1
end
test "#line done line should start from the starting point on the left" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
- assert_select "div.task_done[style*=left:28px]", 1
+ assert_select 'div.task_done[style*="left:28px"]', 1
end
test "#line done line should be the width for the done ratio" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
# 15 days * 4 px * 30% - 2 px for borders = 16 px
- assert_select "div.task_done[style*=width:16px]", 1
+ assert_select 'div.task_done[style*="width:16px"]', 1
end
test "#line done line should be the total width for 100% done ratio" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 100, false, 'line', :format => :html, :zoom => 4)
# 15 days * 4 px - 2 px for borders = 58 px
- assert_select "div.task_done[style*=width:58px]", 1
+ assert_select 'div.task_done[style*="width:58px"]', 1
end
test "#line done line should be the total width for 100% done ratio with same start and end dates" do
create_gantt
@output_buffer = @gantt.line(today + 7, today + 7, 100, false, 'line', :format => :html, :zoom => 4)
- assert_select "div.task_done[style*=width:2px]", 1
+ assert_select 'div.task_done[style*="width:2px"]', 1
end
test "#line done line should not be the total done width if the gantt starts after start date" do
create_gantt
@output_buffer = @gantt.line(today - 16, today - 2, 30, false, 'line', :format => :html, :zoom => 4)
- assert_select "div.task_done[style*=left:0px]", 1
- assert_select "div.task_done[style*=width:8px]", 1
+ assert_select 'div.task_done[style*="left:0px"]', 1
+ assert_select 'div.task_done[style*="width:8px"]', 1
end
test "#line starting marker should appear at the start date" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, true, 'line', :format => :html, :zoom => 4)
assert_select "div.starting", 1
- assert_select "div.starting[style*=left:28px]", 1
+ assert_select 'div.starting[style*="left:28px"]', 1
end
test "#line starting marker should not appear if the start date is before gantt start date" do
@@ -403,7 +403,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, true, 'line', :format => :html, :zoom => 4)
assert_select "div.ending", 1
- assert_select "div.ending[style*=left:88px]", 1
+ assert_select 'div.ending[style*="left:88px"]', 1
end
test "#line ending marker should not appear if the end date is before gantt start date" do
diff --git a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
index d0e905514..dd5e785d5 100644
--- a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
+++ b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
@@ -51,14 +51,14 @@ class Redmine::MenuManager::MenuHelperTest < ActionView::TestCase
node = Redmine::MenuManager::MenuItem.new(:testing, :issues_path)
@output_buffer = render_menu_node(node, nil)
- assert_select "a[href=/issues]", "Testing"
+ assert_select 'a[href="/issues"]', "Testing"
end
def test_render_menu_node_with_symbol_as_url_and_project
node = Redmine::MenuManager::MenuItem.new(:testing, :project_issues_path)
@output_buffer = render_menu_node(node, Project.find(1))
- assert_select "a[href=/projects/ecookbook/issues]", "Testing"
+ assert_select 'a[href="/projects/ecookbook/issues"]', "Testing"
end
def test_render_menu_node_with_nested_items
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index b020e5303..1c732674b 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 ActionDispatch::Assertions::SelectorAssertions
+ include Rails::Dom::Testing::Assertions
fixtures :projects, :enabled_modules, :issues, :users, :email_addresses, :members,
:member_roles, :roles, :documents, :attachments, :news,
:tokens, :journals, :journal_details, :changesets,
@@ -61,11 +61,14 @@ class MailerTest < ActiveSupport::TestCase
# 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 &amp; #3',
+ 'This commit fixes #1, #2 and references #1 & #3',
:text => 'r2'
# link to a description diff
- assert_select 'a[href=?][title=?]',
- 'https://mydomain.foo/journals/diff/3?detail_id=4',
+ assert_select 'a[href^=?][title=?]',
+ # should be https://mydomain.foo/journals/diff/3?detail_id=4
+ # but the Rails 4.2 DOM assertion doesn't handle the ? in the
+ # attribute value
+ 'https://mydomain.foo/journals/diff/3',
'View differences',
:text => 'diff'
# link to an attachment
@@ -100,11 +103,14 @@ class MailerTest < ActiveSupport::TestCase
# 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 &amp; #3',
+ 'This commit fixes #1, #2 and references #1 & #3',
:text => 'r2'
# link to a description diff
- assert_select 'a[href=?][title=?]',
- 'http://mydomain.foo/rdm/journals/diff/3?detail_id=4',
+ assert_select 'a[href^=?][title=?]',
+ # should be http://mydomain.foo/rdm/journals/diff/3?detail_id=4
+ # but the Rails 4.2 DOM assertion doesn't handle the ? in the
+ # attribute value
+ 'http://mydomain.foo/rdm/journals/diff/3',
'View differences',
:text => 'diff'
# link to an attachment
@@ -150,11 +156,14 @@ class MailerTest < ActiveSupport::TestCase
# 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 &amp; #3',
+ 'This commit fixes #1, #2 and references #1 & #3',
:text => 'r2'
# link to a description diff
- assert_select 'a[href=?][title=?]',
- 'http://mydomain.foo/rdm/journals/diff/3?detail_id=4',
+ assert_select 'a[href^=?][title=?]',
+ # should be http://mydomain.foo/rdm/journals/diff/3?detail_id=4
+ # but the Rails 4.2 DOM assertion doesn't handle the ? in the
+ # attribute value
+ 'http://mydomain.foo/rdm/journals/diff/3',
'View differences',
:text => 'diff'
# link to an attachment
@@ -762,10 +771,6 @@ class MailerTest < ActiveSupport::TestCase
end
end
- def test_mail_should_return_a_mail_message
- assert_kind_of ::Mail::Message, Mailer.test_email(User.find(1))
- end
-
def test_with_synched_deliveries_should_yield_with_synced_deliveries
ActionMailer::Base.delivery_method = :async_smtp
ActionMailer::Base.async_smtp_settings = {:foo => 'bar'}