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.
93 lines
4.3 KiB
93 lines
4.3 KiB
9 years ago
|
#-- copyright
|
||
|
# OpenProject Costs Plugin
|
||
|
#
|
||
|
# Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# version 3.
|
||
|
#
|
||
|
# 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.
|
||
|
#++
|
||
|
|
||
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
||
|
|
||
|
describe 'Only see your own rates', type: :feature, js: true do
|
||
|
let(:project) { work_package.project }
|
||
7 years ago
|
let(:user) { FactoryBot.create :user,
|
||
9 years ago
|
member_in_project: project,
|
||
|
member_through_role: role }
|
||
7 years ago
|
let(:role) { FactoryBot.create :role, permissions: [:view_own_hourly_rate,
|
||
9 years ago
|
:view_work_packages,
|
||
|
:view_work_packages,
|
||
|
:view_own_time_entries,
|
||
|
:view_own_cost_entries,
|
||
|
:view_cost_rates,
|
||
|
:log_costs] }
|
||
7 years ago
|
let(:work_package) {FactoryBot.create :work_package }
|
||
8 years ago
|
let(:wp_page) { ::Pages::FullWorkPackage.new(work_package) }
|
||
7 years ago
|
let(:hourly_rate) { FactoryBot.create :default_hourly_rate, user: user,
|
||
9 years ago
|
rate: 10.00 }
|
||
7 years ago
|
let(:time_entry) { FactoryBot.create :time_entry, user: user,
|
||
9 years ago
|
work_package: work_package,
|
||
|
project: project,
|
||
|
hours: 1.00 }
|
||
|
let(:cost_type) {
|
||
7 years ago
|
type = FactoryBot.create :cost_type, name: 'Translations'
|
||
|
FactoryBot.create :cost_rate, cost_type: type,
|
||
9 years ago
|
rate: 7.00
|
||
|
type
|
||
|
}
|
||
7 years ago
|
let(:cost_entry) { FactoryBot.create :cost_entry, work_package: work_package,
|
||
9 years ago
|
project: project,
|
||
|
units: 2.00,
|
||
|
cost_type: cost_type,
|
||
|
user: user }
|
||
7 years ago
|
let(:other_role) { FactoryBot.create :role, permissions: [] }
|
||
|
let(:other_user) { FactoryBot.create :user,
|
||
9 years ago
|
member_in_project: project,
|
||
|
member_through_role: other_role }
|
||
7 years ago
|
let(:other_hourly_rate) { FactoryBot.create :default_hourly_rate, user: other_user,
|
||
9 years ago
|
rate: 11.00 }
|
||
7 years ago
|
let(:other_time_entry) { FactoryBot.create :time_entry, user: other_user,
|
||
9 years ago
|
hours: 3.00,
|
||
|
project: project,
|
||
|
work_package: work_package }
|
||
7 years ago
|
let(:other_cost_entry) { FactoryBot.create :cost_entry, work_package: work_package,
|
||
9 years ago
|
project: project,
|
||
|
units: 5.00,
|
||
|
user: other_user,
|
||
|
cost_type: cost_type }
|
||
|
|
||
8 years ago
|
before do
|
||
|
login_as(user)
|
||
9 years ago
|
|
||
|
work_package
|
||
|
hourly_rate
|
||
|
time_entry
|
||
|
cost_entry
|
||
|
other_hourly_rate
|
||
|
other_time_entry
|
||
|
other_cost_entry
|
||
|
|
||
|
wp_page.visit!
|
||
8 years ago
|
wp_page.ensure_page_loaded
|
||
|
end
|
||
9 years ago
|
|
||
8 years ago
|
it 'only displays own entries and rates' do
|
||
9 years ago
|
# All the values do not include the entries made by the other user
|
||
|
wp_page.expect_attributes spent_time: '1 hour',
|
||
|
costs_by_type: '2 Translations',
|
||
|
overall_costs: '24.00 EUR',
|
||
|
labor_costs: '10.00 EUR',
|
||
|
material_costs: '14.00 EUR'
|
||
|
end
|
||
|
end
|