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/services/issue_rebalancing_service_spec.rb')
-rw-r--r--spec/services/issue_rebalancing_service_spec.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/services/issue_rebalancing_service_spec.rb b/spec/services/issue_rebalancing_service_spec.rb
index 1c7f74264b7..76ccb6d89ea 100644
--- a/spec/services/issue_rebalancing_service_spec.rb
+++ b/spec/services/issue_rebalancing_service_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe IssueRebalancingService do
shared_examples 'IssueRebalancingService shared examples' do
it 'rebalances a set of issues with clumps at the end and start' do
all_issues = start_clump + unclumped + end_clump.reverse
- service = described_class.new(project.issues.first)
+ service = described_class.new(Project.id_in([project.id]))
expect { service.execute }.not_to change { issues_in_position_order.map(&:id) }
@@ -55,7 +55,7 @@ RSpec.describe IssueRebalancingService do
end
it 'is idempotent' do
- service = described_class.new(project.issues.first)
+ service = described_class.new(Project.id_in(project))
expect do
service.execute
@@ -70,17 +70,17 @@ RSpec.describe IssueRebalancingService do
issue.project.group
old_pos = issue.relative_position
- service = described_class.new(issue)
+ service = described_class.new(Project.id_in(project))
expect { service.execute }.not_to exceed_query_limit(0)
expect(old_pos).to eq(issue.reload.relative_position)
end
- it 'acts if the flag is enabled for the project' do
+ it 'acts if the flag is enabled for the root namespace' do
issue = create(:issue, project: project, author: user, relative_position: max_pos)
- stub_feature_flags(rebalance_issues: issue.project)
+ stub_feature_flags(rebalance_issues: project.root_namespace)
- service = described_class.new(issue)
+ service = described_class.new(Project.id_in(project))
expect { service.execute }.to change { issue.reload.relative_position }
end
@@ -90,23 +90,22 @@ RSpec.describe IssueRebalancingService do
project.update!(group: create(:group))
stub_feature_flags(rebalance_issues: issue.project.group)
- service = described_class.new(issue)
+ service = described_class.new(Project.id_in(project))
expect { service.execute }.to change { issue.reload.relative_position }
end
it 'aborts if there are too many issues' do
- issue = project.issues.first
base = double(count: 10_001)
- allow(Issue).to receive(:relative_positioning_query_base).with(issue).and_return(base)
+ allow(Issue).to receive(:in_projects).and_return(base)
- expect { described_class.new(issue).execute }.to raise_error(described_class::TooManyIssues)
+ expect { described_class.new(Project.id_in(project)).execute }.to raise_error(described_class::TooManyIssues)
end
end
shared_examples 'rebalancing is retried on statement timeout exceptions' do
- subject { described_class.new(project.issues.first) }
+ subject { described_class.new(Project.id_in(project)) }
it 'retries update statement' do
call_count = 0