Commit 539963dc authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix tests

parent 73ecc2d5
......@@ -39,11 +39,11 @@ module EE
end
def filter_by_no_weight?
params[:weight].to_s.downcase == FILTER_NONE
params[:weight].to_s.downcase == ::IssuesFinder::FILTER_NONE
end
def filter_by_any_weight?
params[:weight].to_s.downcase == FILTER_ANY
params[:weight].to_s.downcase == ::IssuesFinder::FILTER_ANY
end
override :by_assignee
......
......@@ -39,11 +39,12 @@ describe API::Issues, :mailer do
describe "filtering by weight" do
before do
issue2 = create(:issue, author: user2, project: project, weight: 5)
create(:issue, author: user2, project: project, weight: 1)
create(:issue, author: user2, project: project, weight: 3)
end
let!(:issue2) { create(:issue, author: user2, project: project, weight: 5) }
it 'returns issues with specific weight' do
get api('/issues', user), weight: 5, scope: 'all'
......
......@@ -25,7 +25,7 @@ module API
end
# rubocop: enable CodeReuse/ActiveRecord
params :issues_params do
params :issues_params_ce do
optional :labels, type: String, desc: 'Comma-separated list of label names'
optional :milestone, type: String, desc: 'Milestone title'
optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at',
......@@ -48,6 +48,15 @@ module API
use :pagination
end
params :issues_params_ee do
optional :weight, types: [Integer, String], integer_none_any: true, desc: 'The weight of the issue'
end
params :issues_params do
use :issues_params_ce
use :issues_params_ee
end
params :issue_params_ce do
optional :description, type: String, desc: 'The description of an issue'
optional :assignee_ids, type: Array[Integer], desc: 'The array of user IDs to assign issue'
......@@ -60,7 +69,7 @@ module API
end
params :issue_params_ee do
optional :weight, type: [Integer, String], integer_none_any: true, desc: 'The weight of the issue'
optional :weight, type: Integer, desc: 'The weight of the issue'
end
params :issue_params do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment