Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

adapt bulk edit error feature spec

ulferts224c5d3a0841
diff --git a/spec/features/work_packages/bulk/update_work_package_spec.rb b/spec/features/work_packages/bulk/update_work_package_spec.rb
index d38d429b390..32db96fb2e3 100644
--- a/spec/features/work_packages/bulk/update_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/update_work_package_spec.rb
@@ -71,76 +71,75 @@ describe 'Bulk update work packages through Rails view', js: true do
find('body').send_keys [:control, 'a']
end
- describe 'copying work packages' do
- context 'with permission' do
- let(:current_user) { mover }
+ context 'with permission' do
+ let(:current_user) { mover }
- before do
- context_menu.open_for work_package
- context_menu.choose 'Bulk edit'
+ before do
+ context_menu.open_for work_package
+ context_menu.choose 'Bulk edit'
- select status2.name, from: 'work_package_status_id'
- notes.set_markdown('The typed note')
- end
+ select status2.name, from: 'work_package_status_id'
+ notes.set_markdown('The typed note')
+ end
- it 'sets status and leaves a note' do
- click_on 'Submit'
+ it 'sets status and leaves a note' do
+ click_on 'Submit'
- expect_angular_frontend_initialized
- wp_table.expect_work_package_count 2
+ expect_angular_frontend_initialized
+ wp_table.expect_work_package_count 2
- # Should update the status
- expect([work_package.reload.status_id, work_package2.reload.status_id].uniq)
- .to eq([status2.id])
+ # Should update the status
+ expect([work_package.reload.status_id, work_package2.reload.status_id].uniq)
+ .to eq([status2.id])
- expect([work_package.journals.last.notes, work_package2.journals.last.notes].uniq)
- .to eq(['The typed note'])
- end
+ expect([work_package.journals.last.notes, work_package2.journals.last.notes].uniq)
+ .to eq(['The typed note'])
+ end
- context 'when making an error in the form' do
- let(:work_package2_status) { create(:status) } # without creating a workflow
+ context 'when making an error in the form' do
+ let(:work_package2_status) { create(:status) } # without creating a workflow
- it 'does not update the work packages' do
- fill_in 'work_package_start_date', with: '123'
- click_on 'Submit'
+ it 'does not update the work packages' do
+ fill_in 'Parent', with: '-1'
+ click_on 'Submit'
- expect(page)
- .to have_selector(
- '.flash.error',
- text: I18n.t('work_packages.bulk.none_could_be_saved', total: 2)
- )
-
- expect(page)
- .to have_selector(
- '.flash.error',
- text: "#{work_package.id}: Start date #{I18n.t('activerecord.errors.messages.not_a_date')}"
- )
-
- expect(page)
- .to have_selector(
- '.flash.error',
- text: <<~MSG.squish
- #{work_package2.id}:
- Status #{I18n.t('activerecord.errors.models.work_package.attributes.status_id.status_transition_invalid')}
- MSG
- )
-
- # Should not update the status
- work_package2.reload
- work_package.reload
- expect(work_package.status_id).to eq(status.id)
- expect(work_package2.status_id).to eq(work_package2_status.id)
- end
+ expect(page)
+ .to have_selector(
+ '.flash.error',
+ text: I18n.t('work_packages.bulk.none_could_be_saved', total: 2)
+ )
+
+ expect(page)
+ .to have_selector(
+ '.flash.error',
+ text: "#{work_package.id}: Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}"
+ )
+
+ expect(page)
+ .to have_selector(
+ '.flash.error',
+ text: <<~MSG.squish
+ #{work_package2.id}:
+ Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}
+ Status #{I18n.t('activerecord.errors.models.work_package.attributes.status_id.status_transition_invalid')}
+ MSG
+ )
+
+ # Should not update the status
+ work_package2.reload
+ work_package.reload
+ expect(work_package.status_id).to eq(status.id)
+ expect(work_package2.status_id).to eq(work_package2_status.id)
end
end
+ end
- context 'without permission' do
- let(:current_user) { dev }
+ context 'without permission' do
+ let(:current_user) { dev }
- it 'does not allow to copy' do
- context_menu.open_for work_package
- context_menu.expect_no_options 'Bulk edit'
- end
+ it 'does not allow to copy' do
+ context_menu.open_for work_package
+ context_menu.expect_no_options 'Bulk edit'
end
end