-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a2634c
commit 2d869e0
Showing
9 changed files
with
202 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 36 additions & 26 deletions
62
spec/fixtures/vcr_cassettes/clients_team-maker_does-not-duplicate.yml
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
46 changes: 27 additions & 19 deletions
46
spec/fixtures/vcr_cassettes/clients_team-maker_no-error-on-no-project.yml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
RSpec.describe TeamMakerProjectCreator, type: :service do | ||
let(:project) do | ||
FactoryBot.create(:project, id: 1) | ||
FactoryBot.create(:project, id: 2) | ||
end | ||
|
||
let(:professions) do | ||
|
@@ -25,6 +25,12 @@ | |
FactoryBot.create(:user, email: '[email protected]') | ||
end | ||
|
||
before do | ||
TimeOffType.create(name: 'vacation') | ||
TimeOffType.create(name: 'sick leave') | ||
TimeOffType.create(name: 'errand') | ||
end | ||
|
||
describe '#call' do | ||
it 'creates the requirements' do | ||
VCR.use_cassette('clients#team-maker#list') do | ||
|
@@ -36,7 +42,7 @@ | |
Project.all.each do |project| | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
end.to change(Requirement, :count).by(9) | ||
end.to change(Requirement, :count).by(8) | ||
end | ||
end | ||
|
||
|
@@ -50,7 +56,7 @@ | |
TeamMakerProjectCreator.new(project).call | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
expect(Requirement.count).to eql(9) | ||
expect(Requirement.count).to eql(8) | ||
end | ||
end | ||
|
||
|
@@ -77,11 +83,41 @@ | |
expect do | ||
Project.all.each do |project| | ||
TeamMakerProjectCreator.new(project).call | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
end.to change(Assignment, :count).by(9) | ||
end | ||
end | ||
|
||
it 'creates the assignments time off entries' do | ||
VCR.use_cassette('clients#team-maker#list') do | ||
project | ||
professions | ||
users | ||
|
||
expect do | ||
Project.all.each do |project| | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
end.to change(TimeOff, :count).by(152) | ||
end | ||
end | ||
|
||
it 'does not duplicate the time off entries' do | ||
VCR.use_cassette('clients#team-maker#does-not-duplicate') do | ||
project | ||
professions | ||
users | ||
|
||
expect do | ||
Project.all.each do |project| | ||
TeamMakerProjectCreator.new(project).call | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
end.to change(TimeOff, :count).by(152) | ||
end | ||
end | ||
|
||
it 'creates the time entries' do | ||
VCR.use_cassette('clients#team-maker#list') do | ||
project | ||
|
@@ -92,7 +128,7 @@ | |
Project.all.each do |project| | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
end.to change(TimeEntry, :count).by(352) | ||
end.to change(TimeEntry, :count).by(405) | ||
end | ||
end | ||
|
||
|
@@ -106,7 +142,7 @@ | |
Project.all.each do |project| | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
end.to change(TimeEntry, :count).by(352) | ||
end.to change(TimeEntry, :count).by(405) | ||
end | ||
end | ||
|
||
|
@@ -121,7 +157,7 @@ | |
Project.all.each do |project| | ||
TeamMakerProjectCreator.new(project).call | ||
end | ||
end.to change(Requirement, :count).by(9) | ||
end.to change(Requirement, :count).by(8) | ||
end | ||
end | ||
end | ||
|
Oops, something went wrong.