2822 |
2822 |
assert_select 'select[name="issue[project_id]"]', 0
|
2823 |
2823 |
end
|
2824 |
2824 |
|
|
2825 |
def test_get_new_should_respect_cross_project_subtasks_setting
|
|
2826 |
# # disabled
|
|
2827 |
with_settings :cross_project_subtasks => "" do
|
|
2828 |
@request.session[:user_id] = 2
|
|
2829 |
get :new, :params => {
|
|
2830 |
:project_id => 1,
|
|
2831 |
:tracker_id => 1,
|
|
2832 |
:issue => {
|
|
2833 |
:parent_issue_id => 7
|
|
2834 |
}
|
|
2835 |
}
|
|
2836 |
assert_response :success
|
|
2837 |
assert_select 'select[name=?]', 'issue[project_id]', 0
|
|
2838 |
end
|
|
2839 |
|
|
2840 |
# all projects
|
|
2841 |
with_settings :cross_project_subtasks => "system" do
|
|
2842 |
@request.session[:user_id] = 2
|
|
2843 |
get :new, :params => {
|
|
2844 |
:project_id => 1,
|
|
2845 |
:tracker_id => 1,
|
|
2846 |
:issue => {
|
|
2847 |
:parent_issue_id => 7
|
|
2848 |
}
|
|
2849 |
}
|
|
2850 |
assert_response :success
|
|
2851 |
assert_select 'select[name="issue[project_id]"]' do
|
|
2852 |
assert_select 'option', 4
|
|
2853 |
assert_select 'option[selected=selected]', :text => 'eCookbook'
|
|
2854 |
assert_select 'option[value=?]', '5', :text => ' » Private child of eCookbook'
|
|
2855 |
assert_select 'option[value=?]', '3', :text => ' » eCookbook Subproject 1'
|
|
2856 |
assert_select 'option[value=?]', '2', :text => 'OnlineStore'
|
|
2857 |
end
|
|
2858 |
end
|
|
2859 |
|
|
2860 |
# project tree
|
|
2861 |
with_settings :cross_project_subtasks => "tree" do
|
|
2862 |
@request.session[:user_id] = 2
|
|
2863 |
get :new, :params => {
|
|
2864 |
:project_id => 1,
|
|
2865 |
:tracker_id => 1,
|
|
2866 |
:issue => {
|
|
2867 |
:parent_issue_id => 7
|
|
2868 |
}
|
|
2869 |
}
|
|
2870 |
assert_response :success
|
|
2871 |
assert_select 'select[name="issue[project_id]"]' do
|
|
2872 |
assert_select 'option', 3
|
|
2873 |
assert_select 'option[selected=selected]', :text => 'eCookbook'
|
|
2874 |
assert_select 'option[value=?]', '5', :text => ' » Private child of eCookbook'
|
|
2875 |
assert_select 'option[value=?]', '3', :text => ' » eCookbook Subproject 1'
|
|
2876 |
end
|
|
2877 |
end
|
|
2878 |
|
|
2879 |
# project hierarchy
|
|
2880 |
with_settings :cross_project_subtasks => "hierarchy" do
|
|
2881 |
@request.session[:user_id] = 2
|
|
2882 |
get :new, :params => {
|
|
2883 |
:project_id => 1,
|
|
2884 |
:tracker_id => 1,
|
|
2885 |
:issue => {
|
|
2886 |
:parent_issue_id => 7
|
|
2887 |
}
|
|
2888 |
}
|
|
2889 |
assert_response :success
|
|
2890 |
assert_select 'select[name="issue[project_id]"]' do
|
|
2891 |
assert_select 'option', 3
|
|
2892 |
assert_select 'option[selected=selected]', :text => 'eCookbook'
|
|
2893 |
assert_select 'option[value=?]', '5', :text => ' » Private child of eCookbook'
|
|
2894 |
assert_select 'option[value=?]', '3', :text => ' » eCookbook Subproject 1'
|
|
2895 |
end
|
|
2896 |
end
|
|
2897 |
|
|
2898 |
# subprojects
|
|
2899 |
with_settings :cross_project_subtasks => "descendants" do
|
|
2900 |
@request.session[:user_id] = 2
|
|
2901 |
get :new, :params => {
|
|
2902 |
:project_id => 1,
|
|
2903 |
:tracker_id => 1,
|
|
2904 |
:issue => {
|
|
2905 |
:parent_issue_id => 7
|
|
2906 |
}
|
|
2907 |
}
|
|
2908 |
assert_response :success
|
|
2909 |
assert_select 'select[name="issue[project_id]"]' do
|
|
2910 |
assert_select 'option', 3
|
|
2911 |
assert_select 'option[selected=selected]', :text => 'eCookbook'
|
|
2912 |
assert_select 'option[value=?]', '5', :text => ' » Private child of eCookbook'
|
|
2913 |
assert_select 'option[value=?]', '3', :text => ' » eCookbook Subproject 1'
|
|
2914 |
end
|
|
2915 |
end
|
|
2916 |
end
|
|
2917 |
|
2825 |
2918 |
def test_get_new_with_minimal_permissions
|
2826 |
2919 |
Role.find(1).update_attribute :permissions, [:add_issues]
|
2827 |
2920 |
WorkflowTransition.where(:role_id => 1).delete_all
|