Project

General

Profile

Defect #28693 ยป tests.patch

Mizuki ISHIKAWA, 2018-05-21 10:10

View differences:

test/functional/projects_controller_test.rb
656 656
    assert_select "tr#member-#{member.id}"
657 657
  end
658 658

  
659
  def test_settings_should_show_tabs_according_to_permissions
660
    @request.session[:user_id] = 3
661
    role = User.find(3).roles.first
662

  
663
    role.permissions = []
664
    role.save
665
    role.add_permission! :manage_repository, :manage_boards, :manage_project_activities
666
    get :settings, :params => {
667
      :id => 'ecookbook'
668
    }
669
    assert_response :success
670
    assert_select 'a#tab-repositories'
671
    assert_select 'a#tab-boards'
672
    assert_select 'a#tab-activities'
673
    assert_select 'a#tab-versions', false # Tab that need other permissions
674
  end
675

  
676
  def test_settings_should_be_denied_for_no_permission_to_tabs
677
    @request.session[:user_id] = 3
678
    role = User.find(3).roles.first
679

  
680
    role.remove_permission! :edit_project, :manage_members, :manage_versions, :manage_categories, :manage_project_activities, :manage_repository, :manage_boards
681
    get :settings, :params => {
682
      :id => 'ecookbook'
683
    }
684
    assert_response 403
685
  end
686

  
659 687
  def test_update
660 688
    @request.session[:user_id] = 2 # manager
661 689
    post :update, :params => {
    (1-1/1)