summaryrefslogtreecommitdiffstats
path: root/test/functional/activities_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/activities_controller_test.rb')
-rw-r--r--test/functional/activities_controller_test.rb82
1 files changed, 25 insertions, 57 deletions
diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb
index b5effcd30..8d175256b 100644
--- a/test/functional/activities_controller_test.rb
+++ b/test/functional/activities_controller_test.rb
@@ -36,16 +36,8 @@ class ActivitiesControllerTest < ActionController::TestCase
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
@@ -59,16 +51,8 @@ class ActivitiesControllerTest < ActionController::TestCase
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&#x27;t print recipes/,
- }
- }
- }
+ assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
+ assert_select 'dl dt.issue a', :text => /Can&#x27;t print recipes/
end
def test_global_index
@@ -80,16 +64,9 @@ class ActivitiesControllerTest < ActionController::TestCase
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
@@ -104,16 +81,8 @@ class ActivitiesControllerTest < ActionController::TestCase
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&#x27;t print recipes/,
- }
- }
- }
+ assert_select 'h3', :text => /#{d1.day}/
+ assert_select 'dl dt.issue a', :text => /Can&#x27;t print recipes/
end
def test_user_index_with_invalid_user_id_should_respond_404
@@ -126,14 +95,13 @@ class ActivitiesControllerTest < ActionController::TestCase
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
@@ -150,21 +118,21 @@ class ActivitiesControllerTest < ActionController::TestCase
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&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'}
- assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
- :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;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&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
+ assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;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