##// END OF EJS Templates
Use #assert_select instead of #assert_tag....
Jean-Philippe Lang -
r10836:3976d5e7408d
parent child
Show More
@@ -104,7 +104,7
104 104 <% end %>
105 105
106 106 <% @options_by_custom_field.each do |field, options| %>
107 <li class="folder">
107 <li class="folder cf_<%= field.id %>">
108 108 <a href="#" class="submenu"><%= h(field.name) %></a>
109 109 <ul>
110 110 <% options.each do |text, value| %>
@@ -94,8 +94,8 class AccountControllerTest < ActionController::TestCase
94 94 assert_template 'register'
95 95 assert_not_nil assigns(:user)
96 96
97 assert_tag 'input', :attributes => {:name => 'user[password]'}
98 assert_tag 'input', :attributes => {:name => 'user[password_confirmation]'}
97 assert_select 'input[name=?]', 'user[password]'
98 assert_select 'input[name=?]', 'user[password_confirmation]'
99 99 end
100 100 end
101 101
@@ -36,16 +36,8 class ActivitiesControllerTest < ActionController::TestCase
36 36 assert_template 'index'
37 37 assert_not_nil assigns(:events_by_day)
38 38
39 assert_tag :tag => "h3",
40 :content => /#{2.days.ago.to_date.day}/,
41 :sibling => { :tag => "dl",
42 :child => { :tag => "dt",
43 :attributes => { :class => /issue-edit/ },
44 :child => { :tag => "a",
45 :content => /(#{IssueStatus.find(2).name})/,
46 }
47 }
48 }
39 assert_select 'h3', :text => /#{2.days.ago.to_date.day}/
40 assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/
49 41 end
50 42
51 43 def test_project_index_with_invalid_project_id_should_respond_404
@@ -59,16 +51,8 class ActivitiesControllerTest < ActionController::TestCase
59 51 assert_template 'index'
60 52 assert_not_nil assigns(:events_by_day)
61 53
62 assert_tag :tag => "h3",
63 :content => /#{3.day.ago.to_date.day}/,
64 :sibling => { :tag => "dl",
65 :child => { :tag => "dt",
66 :attributes => { :class => /issue/ },
67 :child => { :tag => "a",
68 :content => /Can&#x27;t print recipes/,
69 }
70 }
71 }
54 assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
55 assert_select 'dl dt.issue a', :text => /Can&#x27;t print recipes/
72 56 end
73 57
74 58 def test_global_index
@@ -80,16 +64,9 class ActivitiesControllerTest < ActionController::TestCase
80 64
81 65 i5 = Issue.find(5)
82 66 d5 = User.find(1).time_to_date(i5.created_on)
83 assert_tag :tag => "h3",
84 :content => /#{d5.day}/,
85 :sibling => { :tag => "dl",
86 :child => { :tag => "dt",
87 :attributes => { :class => /issue/ },
88 :child => { :tag => "a",
89 :content => /Subproject issue/,
90 }
91 }
92 }
67
68 assert_select 'h3', :text => /#{d5.day}/
69 assert_select 'dl dt.issue a', :text => /Subproject issue/
93 70 end
94 71
95 72 def test_user_index
@@ -104,16 +81,8 class ActivitiesControllerTest < ActionController::TestCase
104 81 i1 = Issue.find(1)
105 82 d1 = User.find(1).time_to_date(i1.created_on)
106 83
107 assert_tag :tag => "h3",
108 :content => /#{d1.day}/,
109 :sibling => { :tag => "dl",
110 :child => { :tag => "dt",
111 :attributes => { :class => /issue/ },
112 :child => { :tag => "a",
113 :content => /Can&#x27;t print recipes/,
114 }
115 }
116 }
84 assert_select 'h3', :text => /#{d1.day}/
85 assert_select 'dl dt.issue a', :text => /Can&#x27;t print recipes/
117 86 end
118 87
119 88 def test_user_index_with_invalid_user_id_should_respond_404
@@ -126,14 +95,13 class ActivitiesControllerTest < ActionController::TestCase
126 95 assert_response :success
127 96 assert_template 'common/feed'
128 97
129 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
130 :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'}
131 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
132 :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'}
133
134 assert_tag :tag => 'entry', :child => {
135 :tag => 'link',
136 :attributes => {:href => 'http://test.host/issues/11'}}
98 assert_select 'feed' do
99 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0'
100 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?with_subprojects=0'
101 assert_select 'entry' do
102 assert_select 'link[href=?]', 'http://test.host/issues/11'
103 end
104 end
137 105 end
138 106
139 107 def test_index_atom_feed_with_explicit_selection
@@ -150,21 +118,21 class ActivitiesControllerTest < ActionController::TestCase
150 118 assert_response :success
151 119 assert_template 'common/feed'
152 120
153 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
154 :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'}
155 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
156 :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'}
157
158 assert_tag :tag => 'entry', :child => {
159 :tag => 'link',
160 :attributes => {:href => 'http://test.host/issues/11'}}
121 assert_select 'feed' do
122 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
123 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
124 assert_select 'entry' do
125 assert_select 'link[href=?]', 'http://test.host/issues/11'
126 end
127 end
161 128 end
162 129
163 130 def test_index_atom_feed_with_one_item_type
164 131 get :index, :format => 'atom', :show_issues => '1'
165 132 assert_response :success
166 133 assert_template 'common/feed'
167 assert_tag :tag => 'title', :content => /Issues/
134
135 assert_select 'title', :text => /Issues/
168 136 end
169 137
170 138 def test_index_should_show_private_notes_with_permission_only
@@ -75,8 +75,9 class BoardsControllerTest < ActionController::TestCase
75 75 assert_response :success
76 76 assert_template 'show'
77 77
78 assert_tag 'form', :attributes => {:id => 'message-form'}
79 assert_tag 'input', :attributes => {:name => 'message[subject]'}
78 assert_select 'form#message-form' do
79 assert_select 'input[name=?]', 'message[subject]'
80 end
80 81 end
81 82
82 83 def test_show_atom
@@ -56,42 +56,32 class CalendarsControllerTest < ActionController::TestCase
56 56 get :show, :month => '1', :year => '2010'
57 57 assert_response :success
58 58
59 assert_tag :tag => 'tr',
60 :descendant => {:tag => 'td',
61 :attributes => {:class => 'week-number'}, :content => '53'},
62 :descendant => {:tag => 'td',
63 :attributes => {:class => 'odd'}, :content => '27'},
64 :descendant => {:tag => 'td',
65 :attributes => {:class => 'even'}, :content => '2'}
66
67 assert_tag :tag => 'tr',
68 :descendant => {:tag => 'td',
69 :attributes => {:class => 'week-number'}, :content => '1'},
70 :descendant => {:tag => 'td',
71 :attributes => {:class => 'odd'}, :content => '3'},
72 :descendant => {:tag => 'td',
73 :attributes => {:class => 'even'}, :content => '9'}
59 assert_select 'tr' do
60 assert_select 'td.week-number', :text => '53'
61 assert_select 'td.odd', :text => '27'
62 assert_select 'td.even', :text => '2'
63 end
74 64
65 assert_select 'tr' do
66 assert_select 'td.week-number', :text => '1'
67 assert_select 'td.odd', :text => '3'
68 assert_select 'td.even', :text => '9'
69 end
75 70
76 71 Setting.start_of_week = 1
77 72 get :show, :month => '1', :year => '2010'
78 73 assert_response :success
79 74
80 assert_tag :tag => 'tr',
81 :descendant => {:tag => 'td',
82 :attributes => {:class => 'week-number'}, :content => '53'},
83 :descendant => {:tag => 'td',
84 :attributes => {:class => 'even'}, :content => '28'},
85 :descendant => {:tag => 'td',
86 :attributes => {:class => 'even'}, :content => '3'}
87
88 assert_tag :tag => 'tr',
89 :descendant => {:tag => 'td',
90 :attributes => {:class => 'week-number'}, :content => '1'},
91 :descendant => {:tag => 'td',
92 :attributes => {:class => 'even'}, :content => '4'},
93 :descendant => {:tag => 'td',
94 :attributes => {:class => 'even'}, :content => '10'}
75 assert_select 'tr' do
76 assert_select 'td.week-number', :text => '53'
77 assert_select 'td.even', :text => '28'
78 assert_select 'td.even', :text => '3'
79 end
95 80
81 assert_select 'tr' do
82 assert_select 'td.week-number', :text => '1'
83 assert_select 'td.even', :text => '4'
84 assert_select 'td.even', :text => '10'
85 end
96 86 end
97 87 end
@@ -38,34 +38,21 class ContextMenusControllerTest < ActionController::TestCase
38 38 get :issues, :ids => [1]
39 39 assert_response :success
40 40 assert_template 'context_menu'
41 assert_tag :tag => 'a', :content => 'Edit',
42 :attributes => { :href => '/issues/1/edit',
43 :class => 'icon-edit' }
44 assert_tag :tag => 'a', :content => 'Closed',
45 :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bstatus_id%5D=5',
46 :class => '' }
47 assert_tag :tag => 'a', :content => 'Immediate',
48 :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bpriority_id%5D=8',
49 :class => '' }
50 assert_no_tag :tag => 'a', :content => 'Inactive Priority'
41
42 assert_select 'a.icon-edit[href=?]', '/issues/1/edit', :text => 'Edit'
43 assert_select 'a.icon-copy[href=?]', '/projects/ecookbook/issues/1/copy', :text => 'Copy'
44 assert_select 'a.icon-del[href=?]', '/issues?ids%5B%5D=1', :text => 'Delete'
45
46 # Statuses
47 assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bstatus_id%5D=5', :text => 'Closed'
48 assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bpriority_id%5D=8', :text => 'Immediate'
49 # No inactive priorities
50 assert_select 'a', :text => /Inactive Priority/, :count => 0
51 51 # Versions
52 assert_tag :tag => 'a', :content => '2.0',
53 :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=3',
54 :class => '' }
55 assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0',
56 :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=4',
57 :class => '' }
58
59 assert_tag :tag => 'a', :content => 'Dave Lopper',
60 :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bassigned_to_id%5D=3',
61 :class => '' }
62 assert_tag :tag => 'a', :content => 'Copy',
63 :attributes => { :href => '/projects/ecookbook/issues/1/copy',
64 :class => 'icon-copy' }
65 assert_no_tag :tag => 'a', :content => 'Move'
66 assert_tag :tag => 'a', :content => 'Delete',
67 :attributes => { :href => '/issues?ids%5B%5D=1',
68 :class => 'icon-del' }
52 assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=3', :text => '2.0'
53 assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
54 # Assignees
55 assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
69 56 end
70 57
71 58 def test_context_menu_one_issue_by_anonymous
@@ -86,25 +73,14 class ContextMenusControllerTest < ActionController::TestCase
86 73 assert_equal [1, 2], assigns(:issues).map(&:id).sort
87 74
88 75 ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&amp;')
89 assert_tag :tag => 'a', :content => 'Edit',
90 :attributes => { :href => "/issues/bulk_edit?#{ids}",
91 :class => 'icon-edit' }
92 assert_tag :tag => 'a', :content => 'Closed',
93 :attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue%5Bstatus_id%5D=5",
94 :class => '' }
95 assert_tag :tag => 'a', :content => 'Immediate',
96 :attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue%5Bpriority_id%5D=8",
97 :class => '' }
98 assert_tag :tag => 'a', :content => 'Dave Lopper',
99 :attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue%5Bassigned_to_id%5D=3",
100 :class => '' }
101 assert_tag :tag => 'a', :content => 'Copy',
102 :attributes => { :href => "/issues/bulk_edit?copy=1&amp;#{ids}",
103 :class => 'icon-copy' }
104 assert_no_tag :tag => 'a', :content => 'Move'
105 assert_tag :tag => 'a', :content => 'Delete',
106 :attributes => { :href => "/issues?#{ids}",
107 :class => 'icon-del' }
76
77 assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
78 assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1&amp;#{ids}", :text => 'Copy'
79 assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete'
80
81 assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bstatus_id%5D=5", :text => 'Closed'
82 assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bpriority_id%5D=8", :text => 'Immediate'
83 assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bassigned_to_id%5D=3", :text => 'Dave Lopper'
108 84 end
109 85
110 86 def test_context_menu_multiple_issues_of_different_projects
@@ -116,21 +92,13 class ContextMenusControllerTest < ActionController::TestCase
116 92 assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort
117 93
118 94 ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&amp;')
119 assert_tag :tag => 'a', :content => 'Edit',
120 :attributes => { :href => "/issues/bulk_edit?#{ids}",
121 :class => 'icon-edit' }
122 assert_tag :tag => 'a', :content => 'Closed',
123 :attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue%5Bstatus_id%5D=5",
124 :class => '' }
125 assert_tag :tag => 'a', :content => 'Immediate',
126 :attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue%5Bpriority_id%5D=8",
127 :class => '' }
128 assert_tag :tag => 'a', :content => 'John Smith',
129 :attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue%5Bassigned_to_id%5D=2",
130 :class => '' }
131 assert_tag :tag => 'a', :content => 'Delete',
132 :attributes => { :href => "/issues?#{ids}",
133 :class => 'icon-del' }
95
96 assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
97 assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete'
98
99 assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bstatus_id%5D=5", :text => 'Closed'
100 assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bpriority_id%5D=8", :text => 'Immediate'
101 assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bassigned_to_id%5D=2", :text => 'John Smith'
134 102 end
135 103
136 104 def test_context_menu_should_include_list_custom_fields
@@ -139,17 +107,14 class ContextMenusControllerTest < ActionController::TestCase
139 107 @request.session[:user_id] = 2
140 108 get :issues, :ids => [1]
141 109
142 assert_tag 'a',
143 :content => 'List',
144 :attributes => {:href => '#'},
145 :sibling => {:tag => 'ul', :children => {:count => 3}}
146
147 assert_tag 'a',
148 :content => 'Foo',
149 :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo"}
150 assert_tag 'a',
151 :content => 'none',
152 :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D="}
110 assert_select "li.cf_#{field.id}" do
111 assert_select 'a[href=#]', :text => 'List'
112 assert_select 'ul' do
113 assert_select 'a', 3
114 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo'
115 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
116 end
117 end
153 118 end
154 119
155 120 def test_context_menu_should_not_include_null_value_for_required_custom_fields
@@ -158,10 +123,13 class ContextMenusControllerTest < ActionController::TestCase
158 123 @request.session[:user_id] = 2
159 124 get :issues, :ids => [1, 2]
160 125
161 assert_tag 'a',
162 :content => 'List',
163 :attributes => {:href => '#'},
164 :sibling => {:tag => 'ul', :children => {:count => 2}}
126 assert_select "li.cf_#{field.id}" do
127 assert_select 'a[href=#]', :text => 'List'
128 assert_select 'ul' do
129 assert_select 'a', 2
130 assert_select 'a', :text => 'none', :count => 0
131 end
132 end
165 133 end
166 134
167 135 def test_context_menu_on_single_issue_should_select_current_custom_field_value
@@ -173,13 +141,13 class ContextMenusControllerTest < ActionController::TestCase
173 141 @request.session[:user_id] = 2
174 142 get :issues, :ids => [1]
175 143
176 assert_tag 'a',
177 :content => 'List',
178 :attributes => {:href => '#'},
179 :sibling => {:tag => 'ul', :children => {:count => 3}}
180 assert_tag 'a',
181 :content => 'Bar',
182 :attributes => {:class => /icon-checked/}
144 assert_select "li.cf_#{field.id}" do
145 assert_select 'a[href=#]', :text => 'List'
146 assert_select 'ul' do
147 assert_select 'a', 3
148 assert_select 'a.icon-checked', :text => 'Bar'
149 end
150 end
183 151 end
184 152
185 153 def test_context_menu_should_include_bool_custom_fields
@@ -188,14 +156,15 class ContextMenusControllerTest < ActionController::TestCase
188 156 @request.session[:user_id] = 2
189 157 get :issues, :ids => [1]
190 158
191 assert_tag 'a',
192 :content => 'Bool',
193 :attributes => {:href => '#'},
194 :sibling => {:tag => 'ul', :children => {:count => 3}}
195
196 assert_tag 'a',
197 :content => 'Yes',
198 :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1"}
159 assert_select "li.cf_#{field.id}" do
160 assert_select 'a[href=#]', :text => 'Bool'
161 assert_select 'ul' do
162 assert_select 'a', 3
163 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No'
164 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes'
165 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
166 end
167 end
199 168 end
200 169
201 170 def test_context_menu_should_include_user_custom_fields
@@ -204,14 +173,14 class ContextMenusControllerTest < ActionController::TestCase
204 173 @request.session[:user_id] = 2
205 174 get :issues, :ids => [1]
206 175
207 assert_tag 'a',
208 :content => 'User',
209 :attributes => {:href => '#'},
210 :sibling => {:tag => 'ul', :children => {:count => Project.find(1).members.count + 1}}
211
212 assert_tag 'a',
213 :content => 'John Smith',
214 :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2"}
176 assert_select "li.cf_#{field.id}" do
177 assert_select 'a[href=#]', :text => 'User'
178 assert_select 'ul' do
179 assert_select 'a', Project.find(1).members.count + 1
180 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith'
181 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
182 end
183 end
215 184 end
216 185
217 186 def test_context_menu_should_include_version_custom_fields
@@ -219,14 +188,14 class ContextMenusControllerTest < ActionController::TestCase
219 188 @request.session[:user_id] = 2
220 189 get :issues, :ids => [1]
221 190
222 assert_tag 'a',
223 :content => 'Version',
224 :attributes => {:href => '#'},
225 :sibling => {:tag => 'ul', :children => {:count => Project.find(1).shared_versions.count + 1}}
226
227 assert_tag 'a',
228 :content => '2.0',
229 :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3"}
191 assert_select "li.cf_#{field.id}" do
192 assert_select 'a[href=#]', :text => 'Version'
193 assert_select 'ul' do
194 assert_select 'a', Project.find(1).shared_versions.count + 1
195 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0'
196 assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none'
197 end
198 end
230 199 end
231 200
232 201 def test_context_menu_by_assignable_user_should_include_assigned_to_me_link
@@ -235,9 +204,7 class ContextMenusControllerTest < ActionController::TestCase
235 204 assert_response :success
236 205 assert_template 'context_menu'
237 206
238 assert_tag :tag => 'a', :content => / me /,
239 :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bassigned_to_id%5D=2',
240 :class => '' }
207 assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bassigned_to_id%5D=2', :text => / me /
241 208 end
242 209
243 210 def test_context_menu_should_propose_shared_versions_for_issues_from_different_projects
@@ -249,7 +216,7 class ContextMenusControllerTest < ActionController::TestCase
249 216 assert_template 'context_menu'
250 217
251 218 assert_include version, assigns(:versions)
252 assert_tag :tag => 'a', :content => 'eCookbook - Shared'
219 assert_select 'a', :text => 'eCookbook - Shared'
253 220 end
254 221
255 222 def test_context_menu_issue_visibility
@@ -258,16 +225,16 class ContextMenusControllerTest < ActionController::TestCase
258 225 assert_template 'context_menu'
259 226 assert_equal [1], assigns(:issues).collect(&:id)
260 227 end
261
228
262 229 def test_time_entries_context_menu
263 230 @request.session[:user_id] = 2
264 231 get :time_entries, :ids => [1, 2]
265 232 assert_response :success
266 233 assert_template 'time_entries'
267 assert_tag 'a', :content => 'Edit'
268 assert_no_tag 'a', :content => 'Edit', :attributes => {:class => /disabled/}
234
235 assert_select 'a:not(.disabled)', :text => 'Edit'
269 236 end
270
237
271 238 def test_time_entries_context_menu_without_edit_permission
272 239 @request.session[:user_id] = 2
273 240 Role.find_by_name('Manager').remove_permission! :edit_time_entries
@@ -275,6 +242,6 class ContextMenusControllerTest < ActionController::TestCase
275 242 get :time_entries, :ids => [1, 2]
276 243 assert_response :success
277 244 assert_template 'time_entries'
278 assert_tag 'a', :content => 'Edit', :attributes => {:class => /disabled/}
245 assert_select 'a.disabled', :text => 'Edit'
279 246 end
280 247 end
General Comments 0
You need to be logged in to leave comments. Login now