kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.9 KiB
103 lines
3.9 KiB
6 years ago
|
#-- copyright
|
||
5 years ago
|
# OpenProject is an open source project management software.
|
||
|
# Copyright (C) 2012-2020 the OpenProject GmbH
|
||
6 years ago
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License version 3.
|
||
|
#
|
||
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||
|
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
#
|
||
|
# See docs/COPYRIGHT.rdoc for more details.
|
||
|
#++
|
||
|
|
||
4 years ago
|
require 'spec_helper'
|
||
|
require_relative './mock_global_permissions'
|
||
6 years ago
|
|
||
|
describe 'Global role: Global role assignment', type: :feature, js: true do
|
||
|
before do
|
||
|
login_as(current_user)
|
||
|
end
|
||
|
|
||
|
describe 'Going to the global role assignment page' do
|
||
|
before do
|
||
|
mock_global_permissions [['global1', project_module: :global], ['global2', project_module: :global]]
|
||
|
end
|
||
|
let!(:global_role1) { FactoryBot.create :global_role, name: 'global_role1', permissions: %i[global1] }
|
||
|
let!(:global_role2) { FactoryBot.create :global_role, name: 'global_role2', permissions: %i[global2] }
|
||
4 years ago
|
|
||
6 years ago
|
let!(:user) { FactoryBot.create :user }
|
||
4 years ago
|
let!(:global_member) do
|
||
|
FactoryBot.create(:global_member,
|
||
|
principal: user,
|
||
|
roles: [global_role1])
|
||
|
end
|
||
|
|
||
6 years ago
|
let(:current_user) { FactoryBot.create :admin }
|
||
|
|
||
|
it 'allows global roles management' do
|
||
|
visit edit_user_path user
|
||
5 years ago
|
click_link 'Global Roles'
|
||
4 years ago
|
|
||
6 years ago
|
page.within('#table_principal_roles') do
|
||
|
expect(page).to have_text 'global_role1'
|
||
|
end
|
||
|
# And I should not see "global_role1" within "#available_principal_roles"
|
||
|
# And I should see "global_role2" within "#available_principal_roles"
|
||
|
page.within('#available_principal_roles') do
|
||
|
expect(page).to have_no_text 'global_role1'
|
||
|
expect(page).to have_text 'global_role2'
|
||
|
end
|
||
|
|
||
|
# And I select the available global role "global_role"
|
||
|
check 'global_role2'
|
||
|
# And I press "Add"
|
||
|
click_on 'Add'
|
||
|
|
||
|
# Then I should see "global_role" within "#table_principal_roles"
|
||
|
page.within('#available_principal_roles') do
|
||
|
expect(page).to have_no_text 'global_role1'
|
||
|
expect(page).to have_no_text 'global_role2'
|
||
|
end
|
||
|
# And I should not see "global_role" within "#available_principal_roles"
|
||
|
# And I should see "There is currently nothing to display"
|
||
|
page.within('#table_principal_roles') do
|
||
|
expect(page).to have_text 'global_role1'
|
||
|
expect(page).to have_text 'global_role2'
|
||
|
end
|
||
|
|
||
|
# And I delete the assigned role "global_role"
|
||
4 years ago
|
page.within("#assigned_global_role_#{global_role1.id}") do
|
||
6 years ago
|
page.find('.buttons a.icon-delete').click
|
||
|
end
|
||
|
|
||
|
# Then I should see "global_role" within "#table_principal_roles"
|
||
|
page.within('#available_principal_roles') do
|
||
|
expect(page).to have_text 'global_role1'
|
||
|
expect(page).to have_no_text 'global_role2'
|
||
|
end
|
||
|
# And I should not see "global_role" within "#available_principal_roles"
|
||
|
# And I should see "There is currently nothing to display"
|
||
|
page.within('#table_principal_roles') do
|
||
|
expect(page).to have_no_text 'global_role1'
|
||
|
expect(page).to have_text 'global_role2'
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|