@@ -10,7 +10,47 @@ RSpec.describe Jira::JqlBuilderService do
let(:params){{}}
it'builds jql with default ordering'do
expect(subject).toeq("project = PROJECT_KEY order by created DESC")
expect(subject).toeq('project = PROJECT_KEY order by created DESC')
end
end
context'with search param'do
let(:params){{search: 'new issue'}}
it'builds jql'do
expect(subject).toeq("project = PROJECT_KEY AND (summary ~ \"new issue\" OR description ~ \"new issue\") order by created DESC")
end
context'search param with single qoutes'do
let(:params){{search: "new issue's"}}
it'builds jql'do
expect(subject).toeq("project = PROJECT_KEY AND (summary ~ \"new issue's\" OR description ~ \"new issue's\") order by created DESC")
end
end
context'search param with single double qoutes'do
let(:params){{search: '"one \"more iss\'ue"'}}
it'builds jql'do
expect(subject).toeq("project = PROJECT_KEY AND (summary ~ \"one more iss'ue\" OR description ~ \"one more iss'ue\") order by created DESC")
end
end
context'search param with special characters'do
let(:params){{search: 'issues'+Jira::JqlBuilderService::JQL_SPECIAL_CHARS.join(" AND ")}}
it'builds jql'do
expect(subject).toeq("project = PROJECT_KEY AND (summary ~ \"issues and and and and and and and and and and and and and and and and\" OR description ~ \"issues and and and and and and and and and and and and and and and and\") order by created DESC")
expect(subject).toeq("project = PROJECT_KEY AND labels = \"label1\" AND labels = \"label2\" AND labels = \"\\\"'try\\\"some'more\\\"quote'here\\\"\" order by created DESC")
end
end
...
...
@@ -18,7 +58,7 @@ RSpec.describe Jira::JqlBuilderService do