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.
52 lines
1.5 KiB
52 lines
1.5 KiB
11 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.
|
||
|
#++
|
||
|
|
||
13 years ago
|
require File.dirname(__FILE__) + '/../spec_helper'
|
||
|
|
||
9 years ago
|
describe DefaultHourlyRate, type: :model do
|
||
7 years ago
|
let(:project) { FactoryBot.create(:project) }
|
||
|
let(:user) { FactoryBot.create(:user) }
|
||
9 years ago
|
let(:rate) {
|
||
7 years ago
|
FactoryBot.build(:default_hourly_rate, project: project,
|
||
9 years ago
|
user: user)
|
||
|
}
|
||
13 years ago
|
|
||
10 years ago
|
describe '#user' do
|
||
9 years ago
|
describe 'WHEN an existing user is provided' do
|
||
13 years ago
|
before do
|
||
|
rate.user = user
|
||
|
rate.save!
|
||
|
end
|
||
|
|
||
11 years ago
|
it { expect(rate.user).to eq(user) }
|
||
13 years ago
|
end
|
||
|
|
||
9 years ago
|
describe 'WHEN a non existing user is provided (i.e. the user is deleted)' do
|
||
13 years ago
|
before do
|
||
|
rate.user = user
|
||
|
rate.save!
|
||
|
user.destroy
|
||
|
rate.reload
|
||
|
end
|
||
|
|
||
11 years ago
|
it { expect(rate.user).to eq(DeletedUser.first) }
|
||
13 years ago
|
end
|
||
|
end
|
||
|
end
|