diff options
Diffstat (limited to 'spec/support/shared_examples/services/issuable/update_service_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/services/issuable/update_service_shared_examples.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/support/shared_examples/services/issuable/update_service_shared_examples.rb b/spec/support/shared_examples/services/issuable/update_service_shared_examples.rb new file mode 100644 index 00000000000..3d90885dd6f --- /dev/null +++ b/spec/support/shared_examples/services/issuable/update_service_shared_examples.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +RSpec.shared_examples_for 'issuable update service updating last_edited_at values' do + context 'when updating the title of the issuable' do + let(:update_params) { { title: 'updated title' } } + + it 'does not update last_edited values' do + expect { update_issuable }.to change(issuable, :title).from(issuable.title).to('updated title').and( + not_change(issuable, :last_edited_at) + ).and( + not_change(issuable, :last_edited_by) + ) + end + end + + context 'when updating the description of the issuable' do + let(:update_params) { { description: 'updated description' } } + + it 'updates last_edited values' do + expect do + update_issuable + end.to change(issuable, :description).from(issuable.description).to('updated description').and( + change(issuable, :last_edited_at) + ).and( + change(issuable, :last_edited_by) + ) + end + end +end |