|
|
|
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def test_copy_with_project |
|
|
|
|
|
|
|
|
def test_get_copy |
|
|
@request.session[:user_id] = 1 # admin |
|
|
@request.session[:user_id] = 1 # admin |
|
|
get :copy, :id => 1 |
|
|
get :copy, :id => 1 |
|
|
assert_response :success |
|
|
assert_response :success |
|
|
|
|
|
|
|
|
assert assigns(:project) |
|
|
assert assigns(:project) |
|
|
assert_equal Project.find(1).description, assigns(:project).description |
|
|
assert_equal Project.find(1).description, assigns(:project).description |
|
|
assert_nil assigns(:project).id |
|
|
assert_nil assigns(:project).id |
|
|
|
|
|
|
|
|
|
|
|
assert_tag :tag => 'input', |
|
|
|
|
|
:attributes => {:name => 'project[enabled_module_names][]', :value => 'issue_tracking'} |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def test_copy_without_project |
|
|
|
|
|
|
|
|
def test_get_copy_without_project |
|
|
@request.session[:user_id] = 1 # admin |
|
|
@request.session[:user_id] = 1 # admin |
|
|
get :copy |
|
|
get :copy |
|
|
assert_response :redirect |
|
|
assert_response :redirect |
|
|
|
|
|
|
|
|
:name => 'Copy', |
|
|
:name => 'Copy', |
|
|
:identifier => 'unique-copy', |
|
|
:identifier => 'unique-copy', |
|
|
:tracker_ids => ['1', '2', '3', ''], |
|
|
:tracker_ids => ['1', '2', '3', ''], |
|
|
:enabled_modules => %w(issue_tracking time_tracking) |
|
|
|
|
|
|
|
|
:enabled_module_names => %w(issue_tracking time_tracking) |
|
|
}, |
|
|
}, |
|
|
:only => %w(issues versions) |
|
|
:only => %w(issues versions) |
|
|
end |
|
|
end |
|
|
project = Project.find('unique-copy') |
|
|
project = Project.find('unique-copy') |
|
|
source = Project.find(1) |
|
|
source = Project.find(1) |
|
|
|
|
|
assert_equal %w(issue_tracking time_tracking), project.enabled_module_names.sort |
|
|
|
|
|
|
|
|
assert_equal source.versions.count, project.versions.count, "All versions were not copied" |
|
|
assert_equal source.versions.count, project.versions.count, "All versions were not copied" |
|
|
# issues assigned to a closed version won't be copied |
|
|
# issues assigned to a closed version won't be copied |
|
|
assert_equal source.issues.select {|i| i.fixed_version.nil? || i.fixed_version.open?}.size, |
|
|
assert_equal source.issues.select {|i| i.fixed_version.nil? || i.fixed_version.open?}.size, |