@@ -61,13 +61,15 class IssuesControllerTest < ActionController::TestCase | |||||
61 | assert_template 'index' |
|
61 | assert_template 'index' | |
62 | assert_not_nil assigns(:issues) |
|
62 | assert_not_nil assigns(:issues) | |
63 | assert_nil assigns(:project) |
|
63 | assert_nil assigns(:project) | |
64 | assert_tag :tag => 'a', :content => /Can't print recipes/ |
|
64 | ||
65 | assert_tag :tag => 'a', :content => /Subproject issue/ |
|
65 | # links to visible issues | |
|
66 | assert_select 'a[href=/issues/1]', :text => /Can't print recipes/ | |||
|
67 | assert_select 'a[href=/issues/5]', :text => /Subproject issue/ | |||
66 | # private projects hidden |
|
68 | # private projects hidden | |
67 | assert_no_tag :tag => 'a', :content => /Issue of a private subproject/ |
|
69 | assert_select 'a[href=/issues/6]', 0 | |
68 | assert_no_tag :tag => 'a', :content => /Issue on project 2/ |
|
70 | assert_select 'a[href=/issues/4]', 0 | |
69 | # project column |
|
71 | # project column | |
70 |
assert_t |
|
72 | assert_select 'th', :text => /Project/ | |
71 | end |
|
73 | end | |
72 | end |
|
74 | end | |
73 |
|
75 | |||
@@ -78,8 +80,9 class IssuesControllerTest < ActionController::TestCase | |||||
78 | assert_template 'index' |
|
80 | assert_template 'index' | |
79 | assert_not_nil assigns(:issues) |
|
81 | assert_not_nil assigns(:issues) | |
80 | assert_nil assigns(:project) |
|
82 | assert_nil assigns(:project) | |
81 | assert_no_tag :tag => 'a', :content => /Can't print recipes/ |
|
83 | ||
82 | assert_tag :tag => 'a', :content => /Subproject issue/ |
|
84 | assert_select 'a[href=/issues/1]', 0 | |
|
85 | assert_select 'a[href=/issues/5]', :text => /Subproject issue/ | |||
83 | end |
|
86 | end | |
84 |
|
87 | |||
85 | def test_index_should_list_visible_issues_only |
|
88 | def test_index_should_list_visible_issues_only | |
@@ -95,8 +98,9 class IssuesControllerTest < ActionController::TestCase | |||||
95 | assert_response :success |
|
98 | assert_response :success | |
96 | assert_template 'index' |
|
99 | assert_template 'index' | |
97 | assert_not_nil assigns(:issues) |
|
100 | assert_not_nil assigns(:issues) | |
98 | assert_tag :tag => 'a', :content => /Can't print recipes/ |
|
101 | ||
99 | assert_no_tag :tag => 'a', :content => /Subproject issue/ |
|
102 | assert_select 'a[href=/issues/1]', :text => /Can't print recipes/ | |
|
103 | assert_select 'a[href=/issues/5]', 0 | |||
100 | end |
|
104 | end | |
101 |
|
105 | |||
102 | def test_index_with_project_and_subprojects |
|
106 | def test_index_with_project_and_subprojects | |
@@ -105,21 +109,23 class IssuesControllerTest < ActionController::TestCase | |||||
105 | assert_response :success |
|
109 | assert_response :success | |
106 | assert_template 'index' |
|
110 | assert_template 'index' | |
107 | assert_not_nil assigns(:issues) |
|
111 | assert_not_nil assigns(:issues) | |
108 | assert_tag :tag => 'a', :content => /Can't print recipes/ |
|
112 | ||
109 | assert_tag :tag => 'a', :content => /Subproject issue/ |
|
113 | assert_select 'a[href=/issues/1]', :text => /Can't print recipes/ | |
110 | assert_no_tag :tag => 'a', :content => /Issue of a private subproject/ |
|
114 | assert_select 'a[href=/issues/5]', :text => /Subproject issue/ | |
|
115 | assert_select 'a[href=/issues/6]', 0 | |||
111 | end |
|
116 | end | |
112 |
|
117 | |||
113 | def test_index_with_project_and_subprojects_should_show_private_subprojects |
|
118 | def test_index_with_project_and_subprojects_should_show_private_subprojects_with_permission | |
114 | @request.session[:user_id] = 2 |
|
119 | @request.session[:user_id] = 2 | |
115 | Setting.display_subprojects_issues = 1 |
|
120 | Setting.display_subprojects_issues = 1 | |
116 | get :index, :project_id => 1 |
|
121 | get :index, :project_id => 1 | |
117 | assert_response :success |
|
122 | assert_response :success | |
118 | assert_template 'index' |
|
123 | assert_template 'index' | |
119 | assert_not_nil assigns(:issues) |
|
124 | assert_not_nil assigns(:issues) | |
120 | assert_tag :tag => 'a', :content => /Can't print recipes/ |
|
125 | ||
121 | assert_tag :tag => 'a', :content => /Subproject issue/ |
|
126 | assert_select 'a[href=/issues/1]', :text => /Can't print recipes/ | |
122 | assert_tag :tag => 'a', :content => /Issue of a private subproject/ |
|
127 | assert_select 'a[href=/issues/5]', :text => /Subproject issue/ | |
|
128 | assert_select 'a[href=/issues/6]', :text => /Issue of a private subproject/ | |||
123 | end |
|
129 | end | |
124 |
|
130 | |||
125 | def test_index_with_project_and_default_filter |
|
131 | def test_index_with_project_and_default_filter | |
@@ -551,15 +557,13 class IssuesControllerTest < ActionController::TestCase | |||||
551 | get :index, :project_id => 'ecookbook', :format => 'atom' |
|
557 | get :index, :project_id => 'ecookbook', :format => 'atom' | |
552 | assert_response :success |
|
558 | assert_response :success | |
553 | assert_template 'common/feed' |
|
559 | assert_template 'common/feed' | |
|
560 | assert_equal 'application/atom+xml', response.content_type | |||
554 |
|
561 | |||
555 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, |
|
562 | assert_select 'feed' do | |
556 |
|
|
563 | assert_select 'link[rel=self][href=?]', 'http://test.host/projects/ecookbook/issues.atom' | |
557 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, |
|
564 | assert_select 'link[rel=alternate][href=?]', 'http://test.host/projects/ecookbook/issues' | |
558 | :attributes => {:rel => 'alternate', :href => 'http://test.host/projects/ecookbook/issues'} |
|
565 | assert_select 'entry link[href=?]', 'http://test.host/issues/1' | |
559 |
|
566 | end | ||
560 | assert_tag :tag => 'entry', :child => { |
|
|||
561 | :tag => 'link', |
|
|||
562 | :attributes => {:href => 'http://test.host/issues/1'}} |
|
|||
563 | end |
|
567 | end | |
564 |
|
568 | |||
565 | def test_index_sort |
|
569 | def test_index_sort | |
@@ -1446,10 +1450,10 class IssuesControllerTest < ActionController::TestCase | |||||
1446 | assert_response :success |
|
1450 | assert_response :success | |
1447 | assert_template 'new' |
|
1451 | assert_template 'new' | |
1448 |
|
1452 | |||
1449 | assert_tag 'select', |
|
1453 | assert_select 'select.list_cf[name=?]', 'issue[custom_field_values][1]' do | |
1450 | :attributes => {:name => 'issue[custom_field_values][1]', :class => 'list_cf'}, |
|
1454 | assert_select 'option', 4 | |
1451 | :children => {:count => 4}, |
|
1455 | assert_select 'option[value=MySQL]', :text => 'MySQL' | |
1452 | :child => {:tag => 'option', :attributes => {:value => 'MySQL'}, :content => 'MySQL'} |
|
1456 | end | |
1453 | end |
|
1457 | end | |
1454 |
|
1458 | |||
1455 | def test_get_new_with_multi_custom_field |
|
1459 | def test_get_new_with_multi_custom_field | |
@@ -1461,12 +1465,11 class IssuesControllerTest < ActionController::TestCase | |||||
1461 | assert_response :success |
|
1465 | assert_response :success | |
1462 | assert_template 'new' |
|
1466 | assert_template 'new' | |
1463 |
|
1467 | |||
1464 | assert_tag 'select', |
|
1468 | assert_select 'select[name=?][multiple=multiple]', 'issue[custom_field_values][1][]' do | |
1465 | :attributes => {:name => 'issue[custom_field_values][1][]', :multiple => 'multiple'}, |
|
1469 | assert_select 'option', 3 | |
1466 | :children => {:count => 3}, |
|
1470 | assert_select 'option[value=MySQL]', :text => 'MySQL' | |
1467 | :child => {:tag => 'option', :attributes => {:value => 'MySQL'}, :content => 'MySQL'} |
|
1471 | end | |
1468 | assert_tag 'input', |
|
1472 | assert_select 'input[name=?][type=hidden][value=?]', 'issue[custom_field_values][1][]', '' | |
1469 | :attributes => {:name => 'issue[custom_field_values][1][]', :value => ''} |
|
|||
1470 | end |
|
1473 | end | |
1471 |
|
1474 | |||
1472 | def test_get_new_with_multi_user_custom_field |
|
1475 | def test_get_new_with_multi_user_custom_field | |
@@ -1478,12 +1481,11 class IssuesControllerTest < ActionController::TestCase | |||||
1478 | assert_response :success |
|
1481 | assert_response :success | |
1479 | assert_template 'new' |
|
1482 | assert_template 'new' | |
1480 |
|
1483 | |||
1481 | assert_tag 'select', |
|
1484 | assert_select 'select[name=?][multiple=multiple]', "issue[custom_field_values][#{field.id}][]" do | |
1482 | :attributes => {:name => "issue[custom_field_values][#{field.id}][]", :multiple => 'multiple'}, |
|
1485 | assert_select 'option', Project.find(1).users.count | |
1483 | :children => {:count => Project.find(1).users.count}, |
|
1486 | assert_select 'option[value=2]', :text => 'John Smith' | |
1484 | :child => {:tag => 'option', :attributes => {:value => '2'}, :content => 'John Smith'} |
|
1487 | end | |
1485 | assert_tag 'input', |
|
1488 | assert_select 'input[name=?][type=hidden][value=?]', "issue[custom_field_values][#{field.id}][]", '' | |
1486 | :attributes => {:name => "issue[custom_field_values][#{field.id}][]", :value => ''} |
|
|||
1487 | end |
|
1489 | end | |
1488 |
|
1490 | |||
1489 | def test_get_new_with_date_custom_field |
|
1491 | def test_get_new_with_date_custom_field | |
@@ -1514,8 +1516,8 class IssuesControllerTest < ActionController::TestCase | |||||
1514 | assert_response :success |
|
1516 | assert_response :success | |
1515 | assert_template 'new' |
|
1517 | assert_template 'new' | |
1516 |
|
1518 | |||
1517 |
assert_t |
|
1519 | assert_select 'input[name=?]', 'issue[start_date]' | |
1518 | :value => nil } |
|
1520 | assert_select 'input[name=?][value]', 'issue[start_date]', 0 | |
1519 | end |
|
1521 | end | |
1520 |
|
1522 | |||
1521 | def test_get_new_with_default_start_date_is_creation_date |
|
1523 | def test_get_new_with_default_start_date_is_creation_date | |
@@ -1526,8 +1528,7 class IssuesControllerTest < ActionController::TestCase | |||||
1526 | assert_response :success |
|
1528 | assert_response :success | |
1527 | assert_template 'new' |
|
1529 | assert_template 'new' | |
1528 |
|
1530 | |||
1529 | assert_tag :tag => 'input', :attributes => { :name => 'issue[start_date]', |
|
1531 | assert_select 'input[name=?][value=?]', 'issue[start_date]', Date.today.to_s | |
1530 | :value => Date.today.to_s } |
|
|||
1531 | end |
|
1532 | end | |
1532 |
|
1533 | |||
1533 | def test_get_new_form_should_allow_attachment_upload |
|
1534 | def test_get_new_form_should_allow_attachment_upload | |
@@ -1550,13 +1551,11 class IssuesControllerTest < ActionController::TestCase | |||||
1550 | assert_equal 'Prefilled', issue.description |
|
1551 | assert_equal 'Prefilled', issue.description | |
1551 | assert_equal 'Custom field value', issue.custom_field_value(2) |
|
1552 | assert_equal 'Custom field value', issue.custom_field_value(2) | |
1552 |
|
1553 | |||
1553 | assert_tag 'select', |
|
1554 | assert_select 'select[name=?]', 'issue[tracker_id]' do | |
1554 | :attributes => {:name => 'issue[tracker_id]'}, |
|
1555 | assert_select 'option[value=3][selected=selected]' | |
1555 | :child => {:tag => 'option', :attributes => {:value => '3', :selected => 'selected'}} |
|
1556 | end | |
1556 | assert_tag 'textarea', |
|
1557 | assert_select 'textarea[name=?]', 'issue[description]', :text => /Prefilled/ | |
1557 | :attributes => {:name => 'issue[description]'}, :content => "\nPrefilled" |
|
1558 | assert_select 'input[name=?][value=?]', 'issue[custom_field_values][2]', 'Custom field value' | |
1558 | assert_tag 'input', |
|
|||
1559 | :attributes => {:name => 'issue[custom_field_values][2]', :value => 'Custom field value'} |
|
|||
1560 | end |
|
1559 | end | |
1561 |
|
1560 | |||
1562 | def test_get_new_should_mark_required_fields |
|
1561 | def test_get_new_should_mark_required_fields |
General Comments 0
You need to be logged in to leave comments.
Login now