Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/boards/lists/update_service_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/boards/lists/update_service_shared_examples.rb28
1 files changed, 24 insertions, 4 deletions
diff --git a/spec/support/shared_examples/boards/lists/update_service_shared_examples.rb b/spec/support/shared_examples/boards/lists/update_service_shared_examples.rb
index d8a74f2582d..1fab31cd513 100644
--- a/spec/support/shared_examples/boards/lists/update_service_shared_examples.rb
+++ b/spec/support/shared_examples/boards/lists/update_service_shared_examples.rb
@@ -2,14 +2,30 @@
RSpec.shared_examples 'moving list' do
context 'when user can admin list' do
- it 'calls Lists::MoveService to update list position' do
+ before do
board.resource_parent.add_developer(user)
+ end
+
+ context 'when the new position is valid' do
+ it 'calls Lists::MoveService to update list position' do
+ expect_next_instance_of(Boards::Lists::MoveService, board.resource_parent, user, params) do |move_service|
+ expect(move_service).to receive(:execute).with(list).and_call_original
+ end
- expect_next_instance_of(Boards::Lists::MoveService, board.resource_parent, user, params) do |move_service|
- expect(move_service).to receive(:execute).with(list).and_call_original
+ service.execute(list)
end
- service.execute(list)
+ it 'returns a success response' do
+ expect(service.execute(list)).to be_success
+ end
+ end
+
+ context 'when the new position is invalid' do
+ let(:params) { { position: 10 } }
+
+ it 'returns error response' do
+ expect(service.execute(list)).to be_error
+ end
end
end
@@ -19,6 +35,10 @@ RSpec.shared_examples 'moving list' do
service.execute(list)
end
+
+ it 'returns an error response' do
+ expect(service.execute(list)).to be_error
+ end
end
end