|
|
|
@ -601,6 +601,7 @@ describe Api::V2::PlanningElementsController do |
|
|
|
|
|
|
|
|
|
describe 'update.xml' do |
|
|
|
|
let(:project) { FactoryGirl.create(:project, :is_public => false) } |
|
|
|
|
let(:work_package) { FactoryGirl.create(:work_package) } |
|
|
|
|
|
|
|
|
|
become_admin |
|
|
|
|
|
|
|
|
@ -621,6 +622,41 @@ describe Api::V2::PlanningElementsController do |
|
|
|
|
it_should_behave_like "a controller action which needs project permissions" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'empty' do |
|
|
|
|
before do |
|
|
|
|
put :update, |
|
|
|
|
project_id: work_package.project_id, |
|
|
|
|
id: work_package.id, |
|
|
|
|
format: :xml |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it { expect(response.status).to eq(400) } |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'notes' do |
|
|
|
|
let(:note) { "A note set by API" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
put :update, |
|
|
|
|
project_id: work_package.project_id, |
|
|
|
|
id: work_package.id, |
|
|
|
|
planning_element: { note: note }, |
|
|
|
|
format: :xml |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it { expect(response.status).to eq(204) } |
|
|
|
|
|
|
|
|
|
describe 'journals' do |
|
|
|
|
subject { work_package.reload.journals } |
|
|
|
|
|
|
|
|
|
it { expect(subject.count).to eq(2) } |
|
|
|
|
|
|
|
|
|
it { expect(subject.last.notes).to eq(note) } |
|
|
|
|
|
|
|
|
|
it { expect(subject.last.user).to eq(User.current) } |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'with custom fields' do |
|
|
|
|
let(:type) { Type.find_by_name("None") || FactoryGirl.create(:type_standard) } |
|
|
|
|
|
|
|
|
|