1354 |
1354 |
assert_select 'a', :text => /Next/, :count => 0
|
1355 |
1355 |
end
|
1356 |
1356 |
|
|
1357 |
def test_show_should_display_prev_next_links_when_issue_does_not_match_query_condition_but_request_param_has_link_attributes
|
|
1358 |
@request.session[:query] = {:filters => {'status_id' => {:values => ['5'], :operator => 'c'}}, :project_id => 1}
|
|
1359 |
issue_5 = Issue.find(5)
|
|
1360 |
issue_5.status_id = 5 # be matched the query conditions
|
|
1361 |
issue_5.save!
|
|
1362 |
issue_1 = Issue.find(1)
|
|
1363 |
issue_1.status_id = 1 # not be matched the query conditions
|
|
1364 |
issue_1.save!
|
|
1365 |
|
|
1366 |
get :show, :id => 1, :prev => 1, :next => 3, :pos => 2, :count => 4
|
|
1367 |
assert_response :success
|
|
1368 |
|
|
1369 |
assert_equal '1', assigns(:prev)
|
|
1370 |
assert_equal '3', assigns(:next)
|
|
1371 |
assert_equal '2', assigns(:pos)
|
|
1372 |
assert_equal '4', assigns(:count)
|
|
1373 |
|
|
1374 |
assert_equal '1', assigns(:prev_issue_id)
|
|
1375 |
assert_equal '3', assigns(:next_issue_id)
|
|
1376 |
assert_equal '2', assigns(:issue_position)
|
|
1377 |
assert_equal '4', assigns(:issue_count)
|
|
1378 |
|
|
1379 |
assert_select 'div.next-prev-links' do
|
|
1380 |
assert_select 'a[href="/issues/1"]', :text => /Previous/
|
|
1381 |
assert_select 'a[href="/issues/3"]', :text => /Next/
|
|
1382 |
assert_select 'span.position', :text => "2 of 4"
|
|
1383 |
end
|
|
1384 |
end
|
|
1385 |
|
|
1386 |
def test_show_should_not_display_prev_next_links_when_request_param_has_link_attributes_but_query_results_empty
|
|
1387 |
@request.session[:query] = {:filters => {'status_id' => {:values => ['5'], :operator => 'c'}}, :project_id => 1}
|
|
1388 |
Issue.update_all("status_id=1") # all issues is not matched the qeury condition
|
|
1389 |
|
|
1390 |
get :show, :id => 1, :prev => 1, :next => 3, :pos => 2, :count => 4
|
|
1391 |
assert_response :success
|
|
1392 |
|
|
1393 |
assert_nil assigns(:prev_issue_id)
|
|
1394 |
assert_nil assigns(:next_issue_id)
|
|
1395 |
assert_nil assigns(:issue_position)
|
|
1396 |
assert_nil assigns(:issue_count)
|
|
1397 |
|
|
1398 |
assert_select 'a', :text => /Previous/, :count => 0
|
|
1399 |
assert_select 'a', :text => /Next/, :count => 0
|
|
1400 |
end
|
|
1401 |
|
1357 |
1402 |
def test_show_show_should_display_prev_next_links_with_query_sort_by_user_custom_field
|
1358 |
1403 |
cf = IssueCustomField.create!(:name => 'User', :is_for_all => true, :tracker_ids => [1,2,3], :field_format => 'user')
|
1359 |
1404 |
CustomValue.create!(:custom_field => cf, :customized => Issue.find(1), :value => '2')
|
... | ... | |
3537 |
3582 |
assert ActionMailer::Base.deliveries.empty?
|
3538 |
3583 |
end
|
3539 |
3584 |
|
|
3585 |
def test_put_update_should_retrieve_previous_and_next_issue_ids_and_added_parameters_on_redirect_url
|
|
3586 |
issue = Issue.find(11)
|
|
3587 |
issue.status_id = 5
|
|
3588 |
issue.save!
|
|
3589 |
ActionMailer::Base.deliveries.clear
|
|
3590 |
|
|
3591 |
@request.session[:query] = {:filters => {'status_id' => {:values => ['5'], :operator => 'c'}}, :project_id => 1}
|
|
3592 |
@request.session['issues_index_sort'] = 'id'
|
|
3593 |
@request.session[:user_id] = 2
|
|
3594 |
|
|
3595 |
put :update, :id => 11, :issue => {:status_id => 6, :notes => 'change status.'}
|
|
3596 |
|
|
3597 |
assert_equal 6, assigns(:issue).status_id
|
|
3598 |
issue.reload
|
|
3599 |
assert_equal 6, issue.status_id
|
|
3600 |
|
|
3601 |
assert_equal 3, assigns[:issue_count]
|
|
3602 |
assert_equal 8, assigns[:prev_issue_id]
|
|
3603 |
assert_equal 12, assigns[:next_issue_id]
|
|
3604 |
assert_equal 2, assigns[:issue_position]
|
|
3605 |
assert_redirected_to '/issues/11?count=3&next=12&pos=2&prev=8'
|
|
3606 |
end
|
|
3607 |
|
3540 |
3608 |
def test_put_update_should_send_a_notification
|
3541 |
3609 |
@request.session[:user_id] = 2
|
3542 |
3610 |
ActionMailer::Base.deliveries.clear
|