Project

General

Profile

Feature #34303 » 34303-test.patch

Takenori TAKAKI, 2020-12-04 08:02

View differences:

test/functional/context_menus_controller_test.rb
290 290
    assert_select 'a', :text => 'eCookbook - Shared'
291 291
  end
292 292

  
293
  def test_context_menu_should_include_add_subtask_link
294
    @request.session[:user_id] = 2
295
    get(
296
      :issues,
297
      :params => {
298
        :ids => [1]
299
      }
300
    )
301
    assert_response :success
302

  
303
    assert_select 'a.icon-add[href=?]', '/projects/ecookbook/issues/new?issue%5Bparent_issue_id%5D=1&issue%5Btracker_id%5D=1', :text => 'Add subtask'
304
  end
305

  
306
  def test_context_menu_multiple_issues_should_not_include_add_subtask_link
307
    @request.session[:user_id] = 2
308
    get(
309
      :issues,
310
      :params => {
311
        :ids => [1, 2]
312
      }
313
    )
314
    assert_response :success
315

  
316
    assert_select 'a.icon-add[href=?]', '/projects/ecookbook/issues/new?issue%5Bparent_issue_id%5D=1&issue%5Btracker_id%5D=1', :text => 'Add subtask', :count => 0
317
  end
318

  
293 319
  def test_context_menu_with_issue_that_is_not_visible_should_fail
294 320
    get(
295 321
      :issues,
test/helpers/issues_helper_test.rb
360 360
      assert_equal '06/06/2019', issue_due_date_details(issue)
361 361
    end
362 362
  end
363

  
364
  def test_url_for_new_subtask
365
    issue = Issue.find(1)
366
    params = {:issue => {:parent_issue_id => issue.id, :tracker_id => issue.tracker.id}}
367
    assert_equal new_project_issue_path(issue.project, params),
368
                 url_for_new_subtask(issue)
369
  end
363 370
end
(5-5/6)