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:
parent
eecabc5bb0
commit
3976d5e740
|
@ -104,7 +104,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% @options_by_custom_field.each do |field, options| %>
|
<% @options_by_custom_field.each do |field, options| %>
|
||||||
<li class="folder">
|
<li class="folder cf_<%= field.id %>">
|
||||||
<a href="#" class="submenu"><%= h(field.name) %></a>
|
<a href="#" class="submenu"><%= h(field.name) %></a>
|
||||||
<ul>
|
<ul>
|
||||||
<% options.each do |text, value| %>
|
<% options.each do |text, value| %>
|
||||||
|
|
|
@ -94,8 +94,8 @@ class AccountControllerTest < ActionController::TestCase
|
||||||
assert_template 'register'
|
assert_template 'register'
|
||||||
assert_not_nil assigns(:user)
|
assert_not_nil assigns(:user)
|
||||||
|
|
||||||
assert_tag 'input', :attributes => {:name => 'user[password]'}
|
assert_select 'input[name=?]', 'user[password]'
|
||||||
assert_tag 'input', :attributes => {:name => 'user[password_confirmation]'}
|
assert_select 'input[name=?]', 'user[password_confirmation]'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,16 +36,8 @@ class ActivitiesControllerTest < ActionController::TestCase
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
assert_not_nil assigns(:events_by_day)
|
assert_not_nil assigns(:events_by_day)
|
||||||
|
|
||||||
assert_tag :tag => "h3",
|
assert_select 'h3', :text => /#{2.days.ago.to_date.day}/
|
||||||
:content => /#{2.days.ago.to_date.day}/,
|
assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/
|
||||||
:sibling => { :tag => "dl",
|
|
||||||
:child => { :tag => "dt",
|
|
||||||
:attributes => { :class => /issue-edit/ },
|
|
||||||
:child => { :tag => "a",
|
|
||||||
:content => /(#{IssueStatus.find(2).name})/,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_project_index_with_invalid_project_id_should_respond_404
|
def test_project_index_with_invalid_project_id_should_respond_404
|
||||||
|
@ -59,16 +51,8 @@ class ActivitiesControllerTest < ActionController::TestCase
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
assert_not_nil assigns(:events_by_day)
|
assert_not_nil assigns(:events_by_day)
|
||||||
|
|
||||||
assert_tag :tag => "h3",
|
assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
|
||||||
:content => /#{3.day.ago.to_date.day}/,
|
assert_select 'dl dt.issue a', :text => /Can't print recipes/
|
||||||
:sibling => { :tag => "dl",
|
|
||||||
:child => { :tag => "dt",
|
|
||||||
:attributes => { :class => /issue/ },
|
|
||||||
:child => { :tag => "a",
|
|
||||||
:content => /Can't print recipes/,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_global_index
|
def test_global_index
|
||||||
|
@ -80,16 +64,9 @@ class ActivitiesControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
i5 = Issue.find(5)
|
i5 = Issue.find(5)
|
||||||
d5 = User.find(1).time_to_date(i5.created_on)
|
d5 = User.find(1).time_to_date(i5.created_on)
|
||||||
assert_tag :tag => "h3",
|
|
||||||
:content => /#{d5.day}/,
|
assert_select 'h3', :text => /#{d5.day}/
|
||||||
:sibling => { :tag => "dl",
|
assert_select 'dl dt.issue a', :text => /Subproject issue/
|
||||||
:child => { :tag => "dt",
|
|
||||||
:attributes => { :class => /issue/ },
|
|
||||||
:child => { :tag => "a",
|
|
||||||
:content => /Subproject issue/,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_user_index
|
def test_user_index
|
||||||
|
@ -104,16 +81,8 @@ class ActivitiesControllerTest < ActionController::TestCase
|
||||||
i1 = Issue.find(1)
|
i1 = Issue.find(1)
|
||||||
d1 = User.find(1).time_to_date(i1.created_on)
|
d1 = User.find(1).time_to_date(i1.created_on)
|
||||||
|
|
||||||
assert_tag :tag => "h3",
|
assert_select 'h3', :text => /#{d1.day}/
|
||||||
:content => /#{d1.day}/,
|
assert_select 'dl dt.issue a', :text => /Can't print recipes/
|
||||||
:sibling => { :tag => "dl",
|
|
||||||
:child => { :tag => "dt",
|
|
||||||
:attributes => { :class => /issue/ },
|
|
||||||
:child => { :tag => "a",
|
|
||||||
:content => /Can't print recipes/,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_user_index_with_invalid_user_id_should_respond_404
|
def test_user_index_with_invalid_user_id_should_respond_404
|
||||||
|
@ -126,14 +95,13 @@ class ActivitiesControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'common/feed'
|
assert_template 'common/feed'
|
||||||
|
|
||||||
assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
assert_select 'feed' do
|
||||||
:attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'}
|
assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0'
|
||||||
assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?with_subprojects=0'
|
||||||
:attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'}
|
assert_select 'entry' do
|
||||||
|
assert_select 'link[href=?]', 'http://test.host/issues/11'
|
||||||
assert_tag :tag => 'entry', :child => {
|
end
|
||||||
:tag => 'link',
|
end
|
||||||
:attributes => {:href => 'http://test.host/issues/11'}}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_atom_feed_with_explicit_selection
|
def test_index_atom_feed_with_explicit_selection
|
||||||
|
@ -150,21 +118,21 @@ class ActivitiesControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'common/feed'
|
assert_template 'common/feed'
|
||||||
|
|
||||||
assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
assert_select 'feed' do
|
||||||
: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_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_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
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'
|
||||||
: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_select 'entry' do
|
||||||
|
assert_select 'link[href=?]', 'http://test.host/issues/11'
|
||||||
assert_tag :tag => 'entry', :child => {
|
end
|
||||||
:tag => 'link',
|
end
|
||||||
:attributes => {:href => 'http://test.host/issues/11'}}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_atom_feed_with_one_item_type
|
def test_index_atom_feed_with_one_item_type
|
||||||
get :index, :format => 'atom', :show_issues => '1'
|
get :index, :format => 'atom', :show_issues => '1'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'common/feed'
|
assert_template 'common/feed'
|
||||||
assert_tag :tag => 'title', :content => /Issues/
|
|
||||||
|
assert_select 'title', :text => /Issues/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_should_show_private_notes_with_permission_only
|
def test_index_should_show_private_notes_with_permission_only
|
||||||
|
|
|
@ -75,8 +75,9 @@ class BoardsControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
|
|
||||||
assert_tag 'form', :attributes => {:id => 'message-form'}
|
assert_select 'form#message-form' do
|
||||||
assert_tag 'input', :attributes => {:name => 'message[subject]'}
|
assert_select 'input[name=?]', 'message[subject]'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_atom
|
def test_show_atom
|
||||||
|
|
|
@ -56,42 +56,32 @@ class CalendarsControllerTest < ActionController::TestCase
|
||||||
get :show, :month => '1', :year => '2010'
|
get :show, :month => '1', :year => '2010'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
assert_tag :tag => 'tr',
|
assert_select 'tr' do
|
||||||
:descendant => {:tag => 'td',
|
assert_select 'td.week-number', :text => '53'
|
||||||
:attributes => {:class => 'week-number'}, :content => '53'},
|
assert_select 'td.odd', :text => '27'
|
||||||
:descendant => {:tag => 'td',
|
assert_select 'td.even', :text => '2'
|
||||||
:attributes => {:class => 'odd'}, :content => '27'},
|
end
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'even'}, :content => '2'}
|
|
||||||
|
|
||||||
assert_tag :tag => 'tr',
|
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'week-number'}, :content => '1'},
|
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'odd'}, :content => '3'},
|
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'even'}, :content => '9'}
|
|
||||||
|
|
||||||
|
assert_select 'tr' do
|
||||||
|
assert_select 'td.week-number', :text => '1'
|
||||||
|
assert_select 'td.odd', :text => '3'
|
||||||
|
assert_select 'td.even', :text => '9'
|
||||||
|
end
|
||||||
|
|
||||||
Setting.start_of_week = 1
|
Setting.start_of_week = 1
|
||||||
get :show, :month => '1', :year => '2010'
|
get :show, :month => '1', :year => '2010'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
assert_tag :tag => 'tr',
|
assert_select 'tr' do
|
||||||
:descendant => {:tag => 'td',
|
assert_select 'td.week-number', :text => '53'
|
||||||
:attributes => {:class => 'week-number'}, :content => '53'},
|
assert_select 'td.even', :text => '28'
|
||||||
:descendant => {:tag => 'td',
|
assert_select 'td.even', :text => '3'
|
||||||
:attributes => {:class => 'even'}, :content => '28'},
|
end
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'even'}, :content => '3'}
|
|
||||||
|
|
||||||
assert_tag :tag => 'tr',
|
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'week-number'}, :content => '1'},
|
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'even'}, :content => '4'},
|
|
||||||
:descendant => {:tag => 'td',
|
|
||||||
:attributes => {:class => 'even'}, :content => '10'}
|
|
||||||
|
|
||||||
|
assert_select 'tr' do
|
||||||
|
assert_select 'td.week-number', :text => '1'
|
||||||
|
assert_select 'td.even', :text => '4'
|
||||||
|
assert_select 'td.even', :text => '10'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,34 +38,21 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
get :issues, :ids => [1]
|
get :issues, :ids => [1]
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'context_menu'
|
assert_template 'context_menu'
|
||||||
assert_tag :tag => 'a', :content => 'Edit',
|
|
||||||
:attributes => { :href => '/issues/1/edit',
|
|
||||||
:class => 'icon-edit' }
|
|
||||||
assert_tag :tag => 'a', :content => 'Closed',
|
|
||||||
:attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bstatus_id%5D=5',
|
|
||||||
:class => '' }
|
|
||||||
assert_tag :tag => 'a', :content => 'Immediate',
|
|
||||||
:attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bpriority_id%5D=8',
|
|
||||||
:class => '' }
|
|
||||||
assert_no_tag :tag => 'a', :content => 'Inactive Priority'
|
|
||||||
# Versions
|
|
||||||
assert_tag :tag => 'a', :content => '2.0',
|
|
||||||
:attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3',
|
|
||||||
:class => '' }
|
|
||||||
assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0',
|
|
||||||
:attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4',
|
|
||||||
:class => '' }
|
|
||||||
|
|
||||||
assert_tag :tag => 'a', :content => 'Dave Lopper',
|
assert_select 'a.icon-edit[href=?]', '/issues/1/edit', :text => 'Edit'
|
||||||
:attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3',
|
assert_select 'a.icon-copy[href=?]', '/projects/ecookbook/issues/1/copy', :text => 'Copy'
|
||||||
:class => '' }
|
assert_select 'a.icon-del[href=?]', '/issues?ids%5B%5D=1', :text => 'Delete'
|
||||||
assert_tag :tag => 'a', :content => 'Copy',
|
|
||||||
:attributes => { :href => '/projects/ecookbook/issues/1/copy',
|
# Statuses
|
||||||
:class => 'icon-copy' }
|
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bstatus_id%5D=5', :text => 'Closed'
|
||||||
assert_no_tag :tag => 'a', :content => 'Move'
|
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bpriority_id%5D=8', :text => 'Immediate'
|
||||||
assert_tag :tag => 'a', :content => 'Delete',
|
# No inactive priorities
|
||||||
:attributes => { :href => '/issues?ids%5B%5D=1',
|
assert_select 'a', :text => /Inactive Priority/, :count => 0
|
||||||
:class => 'icon-del' }
|
# Versions
|
||||||
|
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3', :text => '2.0'
|
||||||
|
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
|
||||||
|
# Assignees
|
||||||
|
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_one_issue_by_anonymous
|
def test_context_menu_one_issue_by_anonymous
|
||||||
|
@ -86,25 +73,14 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
assert_equal [1, 2], assigns(:issues).map(&:id).sort
|
assert_equal [1, 2], assigns(:issues).map(&:id).sort
|
||||||
|
|
||||||
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
|
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
|
||||||
assert_tag :tag => 'a', :content => 'Edit',
|
|
||||||
:attributes => { :href => "/issues/bulk_edit?#{ids}",
|
assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
|
||||||
:class => 'icon-edit' }
|
assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1&#{ids}", :text => 'Copy'
|
||||||
assert_tag :tag => 'a', :content => 'Closed',
|
assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete'
|
||||||
:attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5",
|
|
||||||
:class => '' }
|
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed'
|
||||||
assert_tag :tag => 'a', :content => 'Immediate',
|
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate'
|
||||||
:attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8",
|
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=3", :text => 'Dave Lopper'
|
||||||
:class => '' }
|
|
||||||
assert_tag :tag => 'a', :content => 'Dave Lopper',
|
|
||||||
:attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=3",
|
|
||||||
:class => '' }
|
|
||||||
assert_tag :tag => 'a', :content => 'Copy',
|
|
||||||
:attributes => { :href => "/issues/bulk_edit?copy=1&#{ids}",
|
|
||||||
:class => 'icon-copy' }
|
|
||||||
assert_no_tag :tag => 'a', :content => 'Move'
|
|
||||||
assert_tag :tag => 'a', :content => 'Delete',
|
|
||||||
:attributes => { :href => "/issues?#{ids}",
|
|
||||||
:class => 'icon-del' }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_multiple_issues_of_different_projects
|
def test_context_menu_multiple_issues_of_different_projects
|
||||||
|
@ -116,21 +92,13 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort
|
assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort
|
||||||
|
|
||||||
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
|
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
|
||||||
assert_tag :tag => 'a', :content => 'Edit',
|
|
||||||
:attributes => { :href => "/issues/bulk_edit?#{ids}",
|
assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
|
||||||
:class => 'icon-edit' }
|
assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete'
|
||||||
assert_tag :tag => 'a', :content => 'Closed',
|
|
||||||
:attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5",
|
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed'
|
||||||
:class => '' }
|
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate'
|
||||||
assert_tag :tag => 'a', :content => 'Immediate',
|
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=2", :text => 'John Smith'
|
||||||
:attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8",
|
|
||||||
:class => '' }
|
|
||||||
assert_tag :tag => 'a', :content => 'John Smith',
|
|
||||||
:attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=2",
|
|
||||||
:class => '' }
|
|
||||||
assert_tag :tag => 'a', :content => 'Delete',
|
|
||||||
:attributes => { :href => "/issues?#{ids}",
|
|
||||||
:class => 'icon-del' }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_should_include_list_custom_fields
|
def test_context_menu_should_include_list_custom_fields
|
||||||
|
@ -139,17 +107,14 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :issues, :ids => [1]
|
get :issues, :ids => [1]
|
||||||
|
|
||||||
assert_tag 'a',
|
assert_select "li.cf_#{field.id}" do
|
||||||
:content => 'List',
|
assert_select 'a[href=#]', :text => 'List'
|
||||||
:attributes => {:href => '#'},
|
assert_select 'ul' do
|
||||||
:sibling => {:tag => 'ul', :children => {:count => 3}}
|
assert_select 'a', 3
|
||||||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo'
|
||||||
assert_tag 'a',
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
|
||||||
:content => 'Foo',
|
end
|
||||||
:attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo"}
|
end
|
||||||
assert_tag 'a',
|
|
||||||
:content => 'none',
|
|
||||||
:attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D="}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_should_not_include_null_value_for_required_custom_fields
|
def test_context_menu_should_not_include_null_value_for_required_custom_fields
|
||||||
|
@ -158,10 +123,13 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :issues, :ids => [1, 2]
|
get :issues, :ids => [1, 2]
|
||||||
|
|
||||||
assert_tag 'a',
|
assert_select "li.cf_#{field.id}" do
|
||||||
:content => 'List',
|
assert_select 'a[href=#]', :text => 'List'
|
||||||
:attributes => {:href => '#'},
|
assert_select 'ul' do
|
||||||
:sibling => {:tag => 'ul', :children => {:count => 2}}
|
assert_select 'a', 2
|
||||||
|
assert_select 'a', :text => 'none', :count => 0
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_on_single_issue_should_select_current_custom_field_value
|
def test_context_menu_on_single_issue_should_select_current_custom_field_value
|
||||||
|
@ -173,13 +141,13 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :issues, :ids => [1]
|
get :issues, :ids => [1]
|
||||||
|
|
||||||
assert_tag 'a',
|
assert_select "li.cf_#{field.id}" do
|
||||||
:content => 'List',
|
assert_select 'a[href=#]', :text => 'List'
|
||||||
:attributes => {:href => '#'},
|
assert_select 'ul' do
|
||||||
:sibling => {:tag => 'ul', :children => {:count => 3}}
|
assert_select 'a', 3
|
||||||
assert_tag 'a',
|
assert_select 'a.icon-checked', :text => 'Bar'
|
||||||
:content => 'Bar',
|
end
|
||||||
:attributes => {:class => /icon-checked/}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_should_include_bool_custom_fields
|
def test_context_menu_should_include_bool_custom_fields
|
||||||
|
@ -188,14 +156,15 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :issues, :ids => [1]
|
get :issues, :ids => [1]
|
||||||
|
|
||||||
assert_tag 'a',
|
assert_select "li.cf_#{field.id}" do
|
||||||
:content => 'Bool',
|
assert_select 'a[href=#]', :text => 'Bool'
|
||||||
:attributes => {:href => '#'},
|
assert_select 'ul' do
|
||||||
:sibling => {:tag => 'ul', :children => {:count => 3}}
|
assert_select 'a', 3
|
||||||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No'
|
||||||
assert_tag 'a',
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes'
|
||||||
:content => 'Yes',
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
|
||||||
:attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1"}
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_should_include_user_custom_fields
|
def test_context_menu_should_include_user_custom_fields
|
||||||
|
@ -204,14 +173,14 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :issues, :ids => [1]
|
get :issues, :ids => [1]
|
||||||
|
|
||||||
assert_tag 'a',
|
assert_select "li.cf_#{field.id}" do
|
||||||
:content => 'User',
|
assert_select 'a[href=#]', :text => 'User'
|
||||||
:attributes => {:href => '#'},
|
assert_select 'ul' do
|
||||||
:sibling => {:tag => 'ul', :children => {:count => Project.find(1).members.count + 1}}
|
assert_select 'a', Project.find(1).members.count + 1
|
||||||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith'
|
||||||
assert_tag 'a',
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
|
||||||
:content => 'John Smith',
|
end
|
||||||
:attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2"}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_should_include_version_custom_fields
|
def test_context_menu_should_include_version_custom_fields
|
||||||
|
@ -219,14 +188,14 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :issues, :ids => [1]
|
get :issues, :ids => [1]
|
||||||
|
|
||||||
assert_tag 'a',
|
assert_select "li.cf_#{field.id}" do
|
||||||
:content => 'Version',
|
assert_select 'a[href=#]', :text => 'Version'
|
||||||
:attributes => {:href => '#'},
|
assert_select 'ul' do
|
||||||
:sibling => {:tag => 'ul', :children => {:count => Project.find(1).shared_versions.count + 1}}
|
assert_select 'a', Project.find(1).shared_versions.count + 1
|
||||||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0'
|
||||||
assert_tag 'a',
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
|
||||||
:content => '2.0',
|
end
|
||||||
:attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3"}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_by_assignable_user_should_include_assigned_to_me_link
|
def test_context_menu_by_assignable_user_should_include_assigned_to_me_link
|
||||||
|
@ -235,9 +204,7 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'context_menu'
|
assert_template 'context_menu'
|
||||||
|
|
||||||
assert_tag :tag => 'a', :content => / me /,
|
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2', :text => / me /
|
||||||
:attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2',
|
|
||||||
:class => '' }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_should_propose_shared_versions_for_issues_from_different_projects
|
def test_context_menu_should_propose_shared_versions_for_issues_from_different_projects
|
||||||
|
@ -249,7 +216,7 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
assert_template 'context_menu'
|
assert_template 'context_menu'
|
||||||
|
|
||||||
assert_include version, assigns(:versions)
|
assert_include version, assigns(:versions)
|
||||||
assert_tag :tag => 'a', :content => 'eCookbook - Shared'
|
assert_select 'a', :text => 'eCookbook - Shared'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_context_menu_issue_visibility
|
def test_context_menu_issue_visibility
|
||||||
|
@ -264,8 +231,8 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
get :time_entries, :ids => [1, 2]
|
get :time_entries, :ids => [1, 2]
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'time_entries'
|
assert_template 'time_entries'
|
||||||
assert_tag 'a', :content => 'Edit'
|
|
||||||
assert_no_tag 'a', :content => 'Edit', :attributes => {:class => /disabled/}
|
assert_select 'a:not(.disabled)', :text => 'Edit'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_time_entries_context_menu_without_edit_permission
|
def test_time_entries_context_menu_without_edit_permission
|
||||||
|
@ -275,6 +242,6 @@ class ContextMenusControllerTest < ActionController::TestCase
|
||||||
get :time_entries, :ids => [1, 2]
|
get :time_entries, :ids => [1, 2]
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'time_entries'
|
assert_template 'time_entries'
|
||||||
assert_tag 'a', :content => 'Edit', :attributes => {:class => /disabled/}
|
assert_select 'a.disabled', :text => 'Edit'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue