Commit a4b273fc authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'allow-extra-seearch-filters' into 'master'

Allow filtering of jira issues by extra parameters

See merge request gitlab-org/gitlab!36588
parents ed7d1d7d e810818f
......@@ -11,7 +11,9 @@ module Projects
class << self
def valid_params
@valid_params ||= %i[page per_page search state]
@valid_params ||= %i[page per_page search state status author_username assignee_username]
# to permit array params you need to init them to an empty array
@valid_params << { labels: [] }
end
end
......
......@@ -129,6 +129,34 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do
end
end
context 'when status param' do
it_behaves_like 'proper parameter values' do
let(:params) { { 'status' => 'jira status' } }
let(:expected_params) { { 'state' => 'opened', 'status' => 'jira status', 'sort' => 'created_date' } }
end
end
context 'when labels param' do
it_behaves_like 'proper parameter values' do
let(:params) { { 'labels' => %w[label1 label2] } }
let(:expected_params) { { 'state' => 'opened', 'labels' => %w[label1 label2], 'sort' => 'created_date' } }
end
end
context 'when author_username param' do
it_behaves_like 'proper parameter values' do
let(:params) { { 'author_username' => 'some reporter' } }
let(:expected_params) { { 'state' => 'opened', 'author_username' => 'some reporter', 'sort' => 'created_date' } }
end
end
context 'when assignee_username param' do
it_behaves_like 'proper parameter values' do
let(:params) { { 'assignee_username' => 'some assignee' } }
let(:expected_params) { { 'state' => 'opened', 'assignee_username' => 'some assignee', 'sort' => 'created_date' } }
end
end
context 'when invalid params' do
it_behaves_like 'proper parameter values' do
let(:params) { { 'invalid' => '12' } }
......
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