|
|
|
@ -208,30 +208,74 @@ describe ::API::V3::WorkPackages::Schema::SpecificWorkPackageSchema do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'start date' do |
|
|
|
|
it 'is not writable when the work package is a parent' do |
|
|
|
|
allow(work_package).to receive(:leaf?).and_return(false) |
|
|
|
|
expect(subject.writable?(:start_date)).to be false |
|
|
|
|
context 'work package is parent' do |
|
|
|
|
before do |
|
|
|
|
allow(work_package) |
|
|
|
|
.to receive(:leaf?) |
|
|
|
|
.and_return(false) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'scheduled automatically' do |
|
|
|
|
it 'is not writable' do |
|
|
|
|
expect(subject.writable?(:start_date)).to be false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'scheduled manually' do |
|
|
|
|
before do |
|
|
|
|
work_package.schedule_manually = true |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'is writable' do |
|
|
|
|
expect(subject.writable?(:start_date)).to be true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'is writable when the work package is a leaf' do |
|
|
|
|
allow(work_package).to receive(:leaf?).and_return(true) |
|
|
|
|
expect(subject.writable?(:start_date)).to be true |
|
|
|
|
context 'work package is a leaf' do |
|
|
|
|
it 'is writable' do |
|
|
|
|
allow(work_package).to receive(:leaf?).and_return(true) |
|
|
|
|
expect(subject.writable?(:start_date)).to be true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'finish date' do |
|
|
|
|
it 'is not writable when the work package is a parent' do |
|
|
|
|
allow(work_package).to receive(:leaf?).and_return(false) |
|
|
|
|
expect(subject.writable?(:due_date)).to be false |
|
|
|
|
context 'due date' do |
|
|
|
|
context 'work package is parent' do |
|
|
|
|
before do |
|
|
|
|
allow(work_package) |
|
|
|
|
.to receive(:leaf?) |
|
|
|
|
.and_return(false) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'scheduled automatically' do |
|
|
|
|
it 'is not writable' do |
|
|
|
|
expect(subject.writable?(:due_date)).to be false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'scheduled manually' do |
|
|
|
|
before do |
|
|
|
|
work_package.schedule_manually = true |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'is writable' do |
|
|
|
|
expect(subject.writable?(:due_date)).to be true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'is writable when the work package is a leaf' do |
|
|
|
|
allow(work_package).to receive(:leaf?).and_return(true) |
|
|
|
|
expect(subject.writable?(:due_date)).to be true |
|
|
|
|
context 'work package is a leaf' do |
|
|
|
|
it 'is writable' do |
|
|
|
|
allow(work_package).to receive(:leaf?).and_return(true) |
|
|
|
|
expect(subject.writable?(:due_date)).to be true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'date' do |
|
|
|
|
# As a date only exists on milestones, which can have no children |
|
|
|
|
# we do not need to check for differences caused by scheduling modes. |
|
|
|
|
before do |
|
|
|
|
allow(work_package.type).to receive(:is_milestone?).and_return(true) |
|
|
|
|
end |
|
|
|
|