Use #assert_select instead of #assert_tag.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11066 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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'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
|
||||
@@ -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'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
|
||||
@@ -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&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
|
||||
|
||||
Reference in New Issue
Block a user