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 spec to new query create service

Oliver Güntherad9e4546b525
diff --git a/app/services/queries/create_service.rb b/app/services/queries/create_service.rb
index f5dbc9c9a9e..3f0ffd5215e 100644
--- a/app/services/queries/create_service.rb
+++ b/app/services/queries/create_service.rb
@@ -27,7 +27,7 @@
#++
class Queries::CreateService < ::BaseServices::Create
- def after_validate(params, call)
+ def after_validate(_params, call)
query = call.result
# Check which of the work package IDs exist
ids = query.ordered_work_packages.map(&:work_package_id)
diff --git a/spec/services/queries/create_service_spec.rb b/spec/services/queries/create_service_spec.rb
index 328b0c3e8bd..58370d50331 100644
--- a/spec/services/queries/create_service_spec.rb
+++ b/spec/services/queries/create_service_spec.rb
@@ -30,17 +30,20 @@ require 'spec_helper'
describe Queries::CreateService do
let(:user) { build_stubbed(:admin) }
- let(:query) { build(:query, user: user) }
let(:instance) { described_class.new(user: user) }
- subject { instance.call(query).result }
+ subject { instance.call(params).result }
describe 'ordered work packages' do
let!(:work_package) { create :work_package }
-
- before do
- query.ordered_work_packages.build(work_package_id: work_package.id, position: 0)
- query.ordered_work_packages.build(work_package_id: 99999, position: 1)
+ let(:params) do
+ {
+ name: 'My query',
+ ordered_work_packages: {
+ work_package.id => 0,
+ 9999 => 1
+ }
+ }
end
it 'removes items for which work packages do not exist' do
diff --git a/spec/support/components/work_packages/table_configuration_modal.rb b/spec/support/components/work_packages/table_configuration_modal.rb
index 01880f9c75c..a449160fed7 100644
--- a/spec/support/components/work_packages/table_configuration_modal.rb
+++ b/spec/support/components/work_packages/table_configuration_modal.rb
@@ -89,7 +89,7 @@ module Components
end
def expect_disabled_tab(name)
- expect(page).to have_selector("#{selector} [data-qa-tab-disabled]", text: name.upcase)
+ expect(page).to have_selector("#{selector} [data-qa-tab-disabled]", text: name.upcase, wait: 10)
end
def selected_tab(name)