Mercurial > hg > soundsoftware-site
diff test/functional/activities_controller_test.rb @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children | e248c7af89ec |
line wrap: on
line diff
--- a/test/functional/activities_controller_test.rb Fri Jun 14 09:07:32 2013 +0100 +++ b/test/functional/activities_controller_test.rb Fri Jun 14 09:28:30 2013 +0100 @@ -1,3 +1,20 @@ +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + require File.expand_path('../../test_helper', __FILE__) class ActivitiesControllerTest < ActionController::TestCase @@ -9,7 +26,6 @@ :members, :groups_users, :enabled_modules, - :workflows, :journals, :journal_details @@ -19,16 +35,8 @@ assert_template 'index' assert_not_nil assigns(:events_by_day) - assert_tag :tag => "h3", - :content => /#{2.days.ago.to_date.day}/, - :sibling => { :tag => "dl", - :child => { :tag => "dt", - :attributes => { :class => /issue-edit/ }, - :child => { :tag => "a", - :content => /(#{IssueStatus.find(2).name})/, - } - } - } + assert_select 'h3', :text => /#{2.days.ago.to_date.day}/ + assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/ end def test_project_index_with_invalid_project_id_should_respond_404 @@ -42,16 +50,8 @@ assert_template 'index' assert_not_nil assigns(:events_by_day) - assert_tag :tag => "h3", - :content => /#{3.day.ago.to_date.day}/, - :sibling => { :tag => "dl", - :child => { :tag => "dt", - :attributes => { :class => /issue/ }, - :child => { :tag => "a", - :content => /Can't print recipes/, - } - } - } + assert_select 'h3', :text => /#{3.days.ago.to_date.day}/ + assert_select 'dl dt.issue a', :text => /Can't print recipes/ end def test_global_index @@ -63,16 +63,9 @@ i5 = Issue.find(5) d5 = User.find(1).time_to_date(i5.created_on) - assert_tag :tag => "h3", - :content => /#{d5.day}/, - :sibling => { :tag => "dl", - :child => { :tag => "dt", - :attributes => { :class => /issue/ }, - :child => { :tag => "a", - :content => /Subproject issue/, - } - } - } + + assert_select 'h3', :text => /#{d5.day}/ + assert_select 'dl dt.issue a', :text => /Subproject issue/ end def test_user_index @@ -87,16 +80,8 @@ i1 = Issue.find(1) d1 = User.find(1).time_to_date(i1.created_on) - assert_tag :tag => "h3", - :content => /#{d1.day}/, - :sibling => { :tag => "dl", - :child => { :tag => "dt", - :attributes => { :class => /issue/ }, - :child => { :tag => "a", - :content => /Can't print recipes/, - } - } - } + assert_select 'h3', :text => /#{d1.day}/ + assert_select 'dl dt.issue a', :text => /Can't print recipes/ end def test_user_index_with_invalid_user_id_should_respond_404 @@ -109,14 +94,13 @@ assert_response :success assert_template 'common/feed' - assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, - :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'} - assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, - :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'} - - assert_tag :tag => 'entry', :child => { - :tag => 'link', - :attributes => {:href => 'http://test.host/issues/11'}} + assert_select 'feed' do + assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0' + assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?with_subprojects=0' + assert_select 'entry' do + assert_select 'link[href=?]', 'http://test.host/issues/11' + end + end end def test_index_atom_feed_with_explicit_selection @@ -133,21 +117,21 @@ assert_response :success assert_template 'common/feed' - assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, - :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'} - assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, - :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'} - - assert_tag :tag => 'entry', :child => { - :tag => 'link', - :attributes => {:href => 'http://test.host/issues/11'}} + assert_select 'feed' do + assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0' + assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0' + assert_select 'entry' do + assert_select 'link[href=?]', 'http://test.host/issues/11' + end + end end def test_index_atom_feed_with_one_item_type get :index, :format => 'atom', :show_issues => '1' assert_response :success assert_template 'common/feed' - assert_tag :tag => 'title', :content => /Issues/ + + assert_select 'title', :text => /Issues/ end def test_index_should_show_private_notes_with_permission_only