kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
5.9 KiB
124 lines
5.9 KiB
13 years ago
|
#-- encoding: UTF-8
|
||
14 years ago
|
#-- copyright
|
||
|
# ChiliProject is a project management system.
|
||
14 years ago
|
#
|
||
14 years ago
|
# Copyright (C) 2010-2011 the ChiliProject Team
|
||
14 years ago
|
#
|
||
14 years ago
|
# 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.
|
||
14 years ago
|
#
|
||
14 years ago
|
# See doc/COPYRIGHT.rdoc for more details.
|
||
|
#++
|
||
|
|
||
12 years ago
|
require File.expand_path('../../../test_helper', __FILE__)
|
||
14 years ago
|
|
||
12 years ago
|
class Issues::ContextMenusControllerTest < ActionController::TestCase
|
||
14 years ago
|
fixtures :all
|
||
|
|
||
|
def test_context_menu_one_issue
|
||
|
@request.session[:user_id] = 2
|
||
|
get :issues, :ids => [1]
|
||
|
assert_response :success
|
||
|
assert_template 'context_menu'
|
||
|
assert_tag :tag => 'a', :content => 'Edit',
|
||
|
:attributes => { :href => '/issues/1/edit',
|
||
|
:class => 'icon-edit' }
|
||
|
assert_tag :tag => 'a', :content => 'Closed',
|
||
12 years ago
|
:attributes => { :href => '/issues/bulk_update?ids[]=1&issue[status_id]=5',
|
||
14 years ago
|
:class => '' }
|
||
|
assert_tag :tag => 'a', :content => 'Immediate',
|
||
12 years ago
|
:attributes => { :href => '/issues/bulk_update?ids[]=1&issue[priority_id]=8',
|
||
14 years ago
|
:class => '' }
|
||
|
# Versions
|
||
|
assert_tag :tag => 'a', :content => '2.0',
|
||
12 years ago
|
:attributes => { :href => '/issues/bulk_update?ids[]=1&issue[fixed_version_id]=3',
|
||
14 years ago
|
:class => '' }
|
||
|
assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0',
|
||
12 years ago
|
:attributes => { :href => '/issues/bulk_update?ids[]=1&issue[fixed_version_id]=4',
|
||
14 years ago
|
:class => '' }
|
||
|
|
||
|
assert_tag :tag => 'a', :content => 'Dave Lopper',
|
||
12 years ago
|
:attributes => { :href => '/issues/bulk_update?ids[]=1&issue[assigned_to_id]=3',
|
||
14 years ago
|
:class => '' }
|
||
|
assert_tag :tag => 'a', :content => 'Duplicate',
|
||
12 years ago
|
:attributes => { :href => '/projects/ecookbook/issues/new?copy_from=1',
|
||
14 years ago
|
:class => 'icon-duplicate' }
|
||
|
assert_tag :tag => 'a', :content => 'Copy',
|
||
12 years ago
|
:attributes => { :href => '/issues/move/new?copy_options[copy]=t&ids[]=1' }
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Move',
|
||
12 years ago
|
:attributes => { :href => '/issues/move/new?ids[]=1'}
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Delete',
|
||
12 years ago
|
:attributes => { :href => '/issues?ids[]=1' }
|
||
14 years ago
|
end
|
||
|
|
||
|
def test_context_menu_one_issue_by_anonymous
|
||
|
get :issues, :ids => [1]
|
||
|
assert_response :success
|
||
|
assert_template 'context_menu'
|
||
13 years ago
|
assert_select "a.disabled", :text => /Delete/
|
||
14 years ago
|
end
|
||
14 years ago
|
|
||
14 years ago
|
def test_context_menu_multiple_issues_of_same_project
|
||
|
@request.session[:user_id] = 2
|
||
|
get :issues, :ids => [1, 2]
|
||
|
assert_response :success
|
||
|
assert_template 'context_menu'
|
||
14 years ago
|
assert_not_nil assigns(:issues)
|
||
|
assert_equal [1, 2], assigns(:issues).map(&:id).sort
|
||
14 years ago
|
|
||
12 years ago
|
ids = assigns(:issues).map(&:id).map {|i| "ids[]=#{i}"}.join('&')
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Edit',
|
||
14 years ago
|
:attributes => { :href => "/issues/bulk_edit?#{ids}",
|
||
14 years ago
|
:class => 'icon-edit' }
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Closed',
|
||
12 years ago
|
:attributes => { :href => "/issues/bulk_update?#{ids}&issue[status_id]=5",
|
||
14 years ago
|
:class => '' }
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Immediate',
|
||
12 years ago
|
:attributes => { :href => "/issues/bulk_update?#{ids}&issue[priority_id]=8",
|
||
14 years ago
|
:class => '' }
|
||
|
assert_tag :tag => 'a', :content => 'Dave Lopper',
|
||
12 years ago
|
:attributes => { :href => "/issues/bulk_update?#{ids}&issue[assigned_to_id]=3",
|
||
14 years ago
|
:class => '' }
|
||
|
assert_tag :tag => 'a', :content => 'Copy',
|
||
12 years ago
|
:attributes => { :href => "/issues/move/new?copy_options[copy]=t&#{ids}"}
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Move',
|
||
13 years ago
|
:attributes => { :href => "/issues/move/new?#{ids}"}
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Delete',
|
||
12 years ago
|
:attributes => { :href => "/issues?#{ids}"}
|
||
14 years ago
|
end
|
||
|
|
||
14 years ago
|
def test_context_menu_multiple_issues_of_different_projects
|
||
14 years ago
|
@request.session[:user_id] = 2
|
||
14 years ago
|
get :issues, :ids => [1, 2, 6]
|
||
14 years ago
|
assert_response :success
|
||
|
assert_template 'context_menu'
|
||
14 years ago
|
assert_not_nil assigns(:issues)
|
||
|
assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort
|
||
14 years ago
|
|
||
12 years ago
|
ids = assigns(:issues).map(&:id).map {|i| "ids[]=#{i}"}.join('&')
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Edit',
|
||
|
:attributes => { :href => "/issues/bulk_edit?#{ids}",
|
||
|
:class => 'icon-edit' }
|
||
|
assert_tag :tag => 'a', :content => 'Closed',
|
||
12 years ago
|
:attributes => { :href => "/issues/bulk_update?#{ids}&issue[status_id]=5",
|
||
14 years ago
|
:class => '' }
|
||
|
assert_tag :tag => 'a', :content => 'Immediate',
|
||
12 years ago
|
:attributes => { :href => "/issues/bulk_update?#{ids}&issue[priority_id]=8",
|
||
14 years ago
|
:class => '' }
|
||
|
assert_tag :tag => 'a', :content => 'John Smith',
|
||
12 years ago
|
:attributes => { :href => "/issues/bulk_update?#{ids}&issue[assigned_to_id]=2",
|
||
14 years ago
|
:class => '' }
|
||
14 years ago
|
assert_tag :tag => 'a', :content => 'Delete',
|
||
12 years ago
|
:attributes => { :href => "/issues?#{ids}"}
|
||
14 years ago
|
end
|
||
14 years ago
|
|
||
14 years ago
|
def test_context_menu_issue_visibility
|
||
|
get :issues, :ids => [1, 4]
|
||
|
assert_response :success
|
||
|
assert_template 'context_menu'
|
||
|
assert_equal [1], assigns(:issues).collect(&:id)
|
||
|
end
|
||
14 years ago
|
end
|