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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/support/shared_examples/services
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/support/shared_examples/services')
-rw-r--r--spec/support/shared_examples/services/alert_management_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/services/boards/items_list_service_shared_examples.rb40
2 files changed, 30 insertions, 12 deletions
diff --git a/spec/support/shared_examples/services/alert_management_shared_examples.rb b/spec/support/shared_examples/services/alert_management_shared_examples.rb
index 23aee912d2d..f644f1a1687 100644
--- a/spec/support/shared_examples/services/alert_management_shared_examples.rb
+++ b/spec/support/shared_examples/services/alert_management_shared_examples.rb
@@ -32,7 +32,7 @@ RSpec.shared_context 'incident management settings enabled' do
end
before do
- allow(ProjectServiceWorker).to receive(:perform_async)
+ allow(Integrations::ExecuteWorker).to receive(:perform_async)
allow(service)
.to receive(:incident_management_setting)
.and_return(incident_management_setting)
diff --git a/spec/support/shared_examples/services/boards/items_list_service_shared_examples.rb b/spec/support/shared_examples/services/boards/items_list_service_shared_examples.rb
index 9a3a0cc9cc8..ed05a150f8b 100644
--- a/spec/support/shared_examples/services/boards/items_list_service_shared_examples.rb
+++ b/spec/support/shared_examples/services/boards/items_list_service_shared_examples.rb
@@ -3,17 +3,17 @@
RSpec.shared_examples 'items list service' do
it 'avoids N+1' do
params = { board_id: board.id }
- control = ActiveRecord::QueryRecorder.new { described_class.new(parent, user, params).execute }
+ control = ActiveRecord::QueryRecorder.new { list_service(params).execute }
new_list
- expect { described_class.new(parent, user, params).execute }.not_to exceed_query_limit(control)
+ expect { list_service(params).execute }.not_to exceed_query_limit(control)
end
- it 'returns opened items when list_id is missing' do
+ it 'returns opened items when list_id and list are missing' do
params = { board_id: board.id }
- items = described_class.new(parent, user, params).execute
+ items = list_service(params).execute
expect(items).to match_array(backlog_items)
end
@@ -21,7 +21,7 @@ RSpec.shared_examples 'items list service' do
it 'returns opened items when listing items from Backlog' do
params = { board_id: board.id, id: backlog.id }
- items = described_class.new(parent, user, params).execute
+ items = list_service(params).execute
expect(items).to match_array(backlog_items)
end
@@ -29,7 +29,7 @@ RSpec.shared_examples 'items list service' do
it 'returns opened items that have label list applied when listing items from a label list' do
params = { board_id: board.id, id: list1.id }
- items = described_class.new(parent, user, params).execute
+ items = list_service(params).execute
expect(items).to match_array(list1_items)
end
@@ -37,20 +37,24 @@ RSpec.shared_examples 'items list service' do
it 'returns closed items when listing items from Closed sorted by closed_at in descending order' do
params = { board_id: board.id, id: closed.id }
- items = described_class.new(parent, user, params).execute
+ items = list_service(params).execute
expect(items).to eq(closed_items)
end
it 'raises an error if the list does not belong to the board' do
list = create(list_factory) # rubocop:disable Rails/SaveBang
- service = described_class.new(parent, user, board_id: board.id, id: list.id)
+ params = { board_id: board.id, id: list.id }
+
+ service = list_service(params)
expect { service.execute }.to raise_error(ActiveRecord::RecordNotFound)
end
- it 'raises an error if list id is invalid' do
- service = described_class.new(parent, user, board_id: board.id, id: nil)
+ it 'raises an error if list and list id are invalid or missing' do
+ params = { board_id: board.id, id: nil, list: nil }
+
+ service = list_service(params)
expect { service.execute }.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -58,8 +62,22 @@ RSpec.shared_examples 'items list service' do
it 'returns items from all lists if :all_list is used' do
params = { board_id: board.id, all_lists: true }
- items = described_class.new(parent, user, params).execute
+ items = list_service(params).execute
expect(items).to match_array(all_items)
end
+
+ it 'returns opened items that have label list applied when using list param' do
+ params = { board_id: board.id, list: list1 }
+
+ items = list_service(params).execute
+
+ expect(items).to match_array(list1_items)
+ end
+
+ def list_service(params)
+ args = [parent, user].push(params)
+
+ described_class.new(*args)
+ end
end