Project

General

Profile

Defect #28636 » 0001-Include-closed-projects-in-search-for-scope-subproje.patch

Marius BĂLTEANU, 2018-12-06 07:44

View differences:

app/controllers/search_controller.rb
49 49
      when 'my_projects'
50 50
        User.current.projects
51 51
      when 'subprojects'
52
        @project ? (@project.self_and_descendants.active.to_a) : nil
52
        @project ? (@project.self_and_descendants.to_a) : nil
53 53
      else
54 54
        @project
55 55
      end
test/functional/search_controller_test.rb
338 338
    assert_response 404
339 339
  end
340 340

  
341
  def test_search_should_include_closed_projects
342
    @request.session[:user_id] = 1
343

  
344
    project = Project.find(5)
345
    project.close
346
    project.save
347

  
348
    # scope all
349
    get :index, :params => {:q => 'Issue of a private subproject', :scope => 'all'}
350
    assert_response :success
351

  
352
    assert_select '#search-results' do
353
      assert_select 'dt.issue', :text => /Bug #6/
354
    end
355

  
356
    # scope my_projects
357
    get :index, :params => {:q => 'Issue of a private subproject', :scope => 'my_projects'}
358
    assert_response :success
359

  
360
    assert_select '#search-results' do
361
      assert_select 'dt.issue', :text => /Bug #6/
362
    end
363

  
364
    # scope subprojects
365
    get :index, :params => {:id => 1, :q => 'Issue of a private subproject', :scope => 'subprojects'}
366
    assert_response :success
367

  
368
    assert_select '#search-results' do
369
      assert_select 'dt.issue', :text => /Bug #6/
370
    end
371

  
372
    # scope project
373
    get :index, :params => {:id => 5, :q => 'Issue of a private subproject'}
374
    assert_response :success
375

  
376
    assert_select '#search-results' do
377
      assert_select 'dt.issue', :text => /Bug #6/
378
    end
379
  end
380

  
341 381
  def test_quick_jump_to_issue
342 382
    # issue of a public project
343 383
    get :index, :params => {:q => "3"}
    (1-1/1)