43 |
43 |
assert_response :success
|
44 |
44 |
|
45 |
45 |
assert_select 'input[name=?][value="0"][checked=checked]', 'query[visibility]'
|
46 |
|
assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])'
|
|
46 |
assert_select 'input[name=?][type=radio]', 'query[project_id]', 2 do
|
|
47 |
assert_select '[value=""][class="disable-unless-private"]:not([checked])'
|
|
48 |
assert_select '[value="ecookbook"][checked]'
|
|
49 |
end
|
47 |
50 |
assert_select 'select[name=?]', 'c[]' do
|
48 |
51 |
assert_select 'option[value=tracker]'
|
49 |
52 |
assert_select 'option[value=subject]'
|
... | ... | |
56 |
59 |
assert_response :success
|
57 |
60 |
|
58 |
61 |
assert_select 'input[name=?]', 'query[visibility]', 0
|
59 |
|
assert_select 'input[name=query_is_for_all][type=checkbox][checked]:not([disabled])'
|
|
62 |
assert_select 'input[name=?][type=radio]', 'query[project_id]', 1 do
|
|
63 |
assert_select '[value=""][class="disable-unless-private"][checked]'
|
|
64 |
end
|
60 |
65 |
end
|
61 |
66 |
|
62 |
67 |
def test_new_on_invalid_project
|
... | ... | |
84 |
89 |
get(:new, :params => {:project_id => 1, :type => 'TimeEntryQuery'})
|
85 |
90 |
assert_response :success
|
86 |
91 |
assert_select 'input[name=type][value=?]', 'TimeEntryQuery'
|
|
92 |
assert_select 'input[name=?][type=radio]', 'query[project_id]', 2 do
|
|
93 |
assert_select '[value=""][class="disable-unless-private"]:not([checked])'
|
|
94 |
assert_select '[value="ecookbook"][checked]'
|
|
95 |
end
|
87 |
96 |
assert_select 'p[class=?]', 'totable_columns', 1
|
88 |
97 |
assert_select 'p[class=?]', 'block_columns', 0
|
89 |
98 |
end
|
... | ... | |
93 |
102 |
get(:new, :params => {:type => 'ProjectQuery'})
|
94 |
103 |
assert_response :success
|
95 |
104 |
assert_select 'input[name=type][value=?]', 'ProjectQuery'
|
|
105 |
assert_select 'input[name=?]', 'query[project_id]', 0
|
96 |
106 |
end
|
97 |
107 |
|
98 |
108 |
def test_new_project_query_should_not_render_roles_visibility_options
|
... | ... | |
104 |
114 |
assert_select 'input[id=?]', 'query_visibility_1', 0
|
105 |
115 |
end
|
106 |
116 |
|
107 |
|
def test_new_project_query_should_not_render_for_all_projects_option
|
108 |
|
@request.session[:user_id] = 1
|
109 |
|
get(:new, :params => {:type => 'ProjectQuery'})
|
110 |
|
assert_response :success
|
111 |
|
assert_select 'input[name=?]', 'for_all_projects', 0
|
112 |
|
end
|
113 |
|
|
114 |
117 |
def test_new_time_entry_query_should_select_spent_time_from_main_menu
|
115 |
118 |
@request.session[:user_id] = 2
|
116 |
119 |
get(
|
... | ... | |
147 |
150 |
assert_select 'fieldset#filters'
|
148 |
151 |
assert_select 'fieldset legend', {:text => 'Sort', :count => 0}
|
149 |
152 |
assert_select 'fieldset#columns'
|
|
153 |
assert_select 'input[name=?]', 'query[project_id]'
|
150 |
154 |
end
|
151 |
155 |
|
152 |
156 |
def test_new_with_calendar_params
|
... | ... | |
159 |
163 |
assert_select 'fieldset#filters'
|
160 |
164 |
assert_select 'fieldset legend', {:text => 'Sort', :count => 0}
|
161 |
165 |
assert_select 'fieldset#columns', :count => 0
|
|
166 |
assert_select 'input[name=?]', 'query[project_id]'
|
162 |
167 |
end
|
163 |
168 |
|
164 |
169 |
def test_new_without_gantt_and_calendar_params
|
... | ... | |
187 |
192 |
"assigned_to_id" => ["1"], "status_id" => ["1"]
|
188 |
193 |
},
|
189 |
194 |
:query => {
|
190 |
|
"name" => "test_new_project_public_query", "visibility" => "2"
|
|
195 |
"name" => "test_new_project_public_query", "visibility" => "2", "project_id" => "ecookbook"
|
191 |
196 |
}
|
192 |
197 |
}
|
193 |
198 |
)
|
... | ... | |
241 |
246 |
:query => {
|
242 |
247 |
"name" => "test_create_project_roles_query",
|
243 |
248 |
"visibility" => "1",
|
244 |
|
"role_ids" => ["1", "2", ""]
|
|
249 |
"role_ids" => ["1", "2", ""],
|
|
250 |
"project_id" => "ecookbook"
|
245 |
251 |
}
|
246 |
252 |
}
|
247 |
253 |
)
|
... | ... | |
441 |
447 |
:params => {
|
442 |
448 |
:project_id => 'ecookbook',
|
443 |
449 |
:query => {
|
444 |
|
"name" => "name", "visibility" => "2"
|
|
450 |
"name" => "name", "visibility" => "2", "project_id" => "ecookbook"
|
445 |
451 |
}
|
446 |
452 |
}
|
447 |
453 |
)
|
... | ... | |
458 |
464 |
:create,
|
459 |
465 |
:params => {
|
460 |
466 |
:project_id => 'ecookbook',
|
461 |
|
:query_is_for_all => '1',
|
462 |
467 |
:query => {
|
463 |
|
"name" => "name", "visibility" => "2"
|
|
468 |
"name" => "name", "visibility" => "2", "project_id" => ""
|
464 |
469 |
}
|
465 |
470 |
}
|
466 |
471 |
)
|
... | ... | |
478 |
483 |
:params => {
|
479 |
484 |
:project_id => 'ecookbook',
|
480 |
485 |
:query => {
|
481 |
|
"name" => "name", "visibility" => "2"
|
|
486 |
"name" => "name", "visibility" => "2", "project_id" => "ecookbook"
|
482 |
487 |
}
|
483 |
488 |
}
|
484 |
489 |
)
|
... | ... | |
495 |
500 |
:create,
|
496 |
501 |
:params => {
|
497 |
502 |
:project_id => 'ecookbook',
|
498 |
|
:query_is_for_all => '1',
|
499 |
503 |
:query => {
|
500 |
|
"name" => "name", "visibility" => "2"
|
|
504 |
"name" => "name", "visibility" => "2", "project_id" => ""
|
501 |
505 |
}
|
502 |
506 |
}
|
503 |
507 |
)
|
... | ... | |
514 |
518 |
:create,
|
515 |
519 |
:params => {
|
516 |
520 |
:project_id => 'ecookbook',
|
517 |
|
:query_is_for_all => '1',
|
518 |
521 |
:query => {
|
519 |
|
"name" => "name", "visibility" => "2"
|
|
522 |
"name" => "name", "visibility" => "2", "project_id" => ""
|
520 |
523 |
}
|
521 |
524 |
}
|
522 |
525 |
)
|
... | ... | |
544 |
547 |
"spent_on" => ["2016-07-14"]
|
545 |
548 |
},
|
546 |
549 |
:query => {
|
547 |
|
"name" => "test_new_project_public_query", "visibility" => "2"
|
|
550 |
"name" => "test_new_project_public_query", "visibility" => "2", "project_id" => "ecookbook"
|
548 |
551 |
}
|
549 |
552 |
}
|
550 |
553 |
)
|
... | ... | |
618 |
621 |
assert_response :success
|
619 |
622 |
|
620 |
623 |
assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]'
|
621 |
|
assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked]'
|
|
624 |
assert_select 'input[name=?][type=radio]', 'query[project_id]', 1 do
|
|
625 |
assert_select '[value=""][checked]:not([class="disable-unless-private"])'
|
|
626 |
end
|
622 |
627 |
end
|
623 |
628 |
|
624 |
629 |
def test_edit_global_private_query
|
... | ... | |
627 |
632 |
assert_response :success
|
628 |
633 |
|
629 |
634 |
assert_select 'input[name=?]', 'query[visibility]', 0
|
630 |
|
assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked]'
|
|
635 |
assert_select 'input[name=?][type=radio]', 'query[project_id]', 1 do
|
|
636 |
assert_select '[value=""][class="disable-unless-private"][checked]'
|
|
637 |
end
|
631 |
638 |
end
|
632 |
639 |
|
633 |
640 |
def test_edit_project_private_query
|
634 |
641 |
@request.session[:user_id] = 3
|
635 |
|
get(:edit, :params => {:id => 2})
|
|
642 |
get(:edit, :params => {:id => 2, :project_id => 'ecookbook'})
|
636 |
643 |
assert_response :success
|
637 |
644 |
|
638 |
645 |
assert_select 'input[name=?]', 'query[visibility]', 0
|
639 |
|
assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked])'
|
|
646 |
assert_select 'input[name=?][type=radio]', 'query[project_id]', 2 do
|
|
647 |
assert_select '[value=""][class="disable-unless-private"]:not([checked])'
|
|
648 |
assert_select '[value="ecookbook"][checked]'
|
|
649 |
end
|
640 |
650 |
end
|
641 |
651 |
|
642 |
652 |
def test_edit_project_public_query
|
643 |
653 |
@request.session[:user_id] = 2
|
644 |
|
get(:edit, :params => {:id => 1})
|
|
654 |
get(:edit, :params => {:id => 1, :project_id => 'ecookbook'})
|
645 |
655 |
assert_response :success
|
646 |
656 |
|
647 |
657 |
assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]'
|
648 |
|
assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked])'
|
|
658 |
assert_select 'input[name=?][type=radio]', 'query[project_id]', 2 do
|
|
659 |
assert_select '[value=""][class="disable-unless-private"]:not([checked])'
|
|
660 |
assert_select '[value="ecookbook"][checked]'
|
|
661 |
end
|
649 |
662 |
end
|
650 |
663 |
|
651 |
664 |
def test_edit_sort_criteria
|
... | ... | |
680 |
693 |
"assigned_to_id" => ["me"], "status_id" => ["1"]
|
681 |
694 |
},
|
682 |
695 |
:query => {
|
683 |
|
"name" => "test_edit_global_private_query", "visibility" => "2"
|
|
696 |
"name" => "test_edit_global_private_query", "visibility" => "2", "project_id" => ""
|
684 |
697 |
}
|
685 |
698 |
}
|
686 |
699 |
)
|
... | ... | |
688 |
701 |
q = Query.find_by_name('test_edit_global_private_query')
|
689 |
702 |
assert !q.is_public?
|
690 |
703 |
assert q.has_default_columns?
|
|
704 |
assert_nil q.project
|
691 |
705 |
assert q.valid?
|
692 |
706 |
end
|
693 |
707 |
|
... | ... | |
706 |
720 |
"assigned_to_id" => ["1"], "status_id" => ["1"]
|
707 |
721 |
},
|
708 |
722 |
:query => {
|
709 |
|
"name" => "test_edit_global_public_query", "visibility" => "2"
|
|
723 |
"name" => "test_edit_global_public_query", "visibility" => "2", "project_id" => ""
|
710 |
724 |
}
|
711 |
725 |
}
|
712 |
726 |
)
|
... | ... | |
714 |
728 |
q = Query.find_by_name('test_edit_global_public_query')
|
715 |
729 |
assert q.is_public?
|
716 |
730 |
assert q.has_default_columns?
|
|
731 |
assert_nil q.project
|
717 |
732 |
assert q.valid?
|
718 |
733 |
end
|
719 |
734 |
|
|
735 |
def test_update_global_private_query_when_change_global_to_project_should_set_project
|
|
736 |
assert_nil Query.find_by_name('test_edit_global_private_query')
|
|
737 |
@request.session[:user_id] = 3
|
|
738 |
put(
|
|
739 |
:update,
|
|
740 |
:params => {
|
|
741 |
:id => 3,
|
|
742 |
:project_id => 'ecookbook',
|
|
743 |
:query => {
|
|
744 |
"name" => "test_edit_global_private_query", "visibility" => "0", "project_id" => "ecookbook"
|
|
745 |
}
|
|
746 |
}
|
|
747 |
)
|
|
748 |
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => 3
|
|
749 |
q = Query.find_by_name('test_edit_global_private_query')
|
|
750 |
assert !q.is_global?
|
|
751 |
assert q.project
|
|
752 |
end
|
|
753 |
|
|
754 |
def test_update_project_private_query_when_change_project_to_global_should_not_set_project
|
|
755 |
assert_nil Query.find_by_name('test_edit_project_private_query')
|
|
756 |
@request.session[:user_id] = 3
|
|
757 |
put(
|
|
758 |
:update,
|
|
759 |
:params => {
|
|
760 |
:id => 2,
|
|
761 |
:project_id => 'ecookbook',
|
|
762 |
:query => {
|
|
763 |
"name" => "test_edit_project_private_query", "visibility" => "0", "project_id" => ""
|
|
764 |
}
|
|
765 |
}
|
|
766 |
)
|
|
767 |
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => 2
|
|
768 |
q = Query.find_by_name('test_edit_project_private_query')
|
|
769 |
assert q.is_global?
|
|
770 |
assert_nil q.project
|
|
771 |
end
|
|
772 |
|
720 |
773 |
def test_update_admin_projects_query
|
721 |
774 |
q = ProjectQuery.create(:name => 'project_query')
|
722 |
775 |
@request.session[:user_id] = 1
|