Skip to content

Commit

Permalink
rubocop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGorbanev committed Jun 22, 2019
1 parent e11022c commit f2e7cb0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
11 changes: 6 additions & 5 deletions apps/web/views/vacancies/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ def remote_filter_button(text:, remote_value:)
if remote_value == current_remote_query
{ class: 'btn btn-light active' }
else
{
class: 'btn btn-light',
href: routes.root_path(remote_value.nil? ? {} : { remote: remote_value })
}
{ class: 'btn btn-light', href: remote_filter_button_href(remote_value) }
end

html.a(link_params) do
Expand All @@ -58,7 +55,11 @@ def remote_filter_button(text:, remote_value:)
private

def current_remote_query
params[:remote] if ['true', 'false'].include?(params[:remote])
params[:remote] if params[:remote] == 'true' || params[:remote] == 'false'
end

def remote_filter_button_href(remote_value)
routes.root_path(remote_value.nil? ? {} : { remote: remote_value })
end
end
end
Expand Down
8 changes: 6 additions & 2 deletions lib/vacancies/operations/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ class List < ::Libs::Operation

def call(search_query: {}, page: 1, remote_query: nil) # rubocop:disable Lint/UnusedMethodArgument
remote_available = { 'true' => true, 'false' => false }[remote_query]
pager = vacancy_query.pager_for_all_with_contact(limit: PAGINATION_LIMIT, page: page || 1, remote_available: remote_available)
result = vacancy_query.all_with_contact(limit: PAGINATION_LIMIT, page: page || 1, remote_available: remote_available)
pager = vacancy_query.pager_for_all_with_contact(limit: PAGINATION_LIMIT,
page: page || 1,
remote_available: remote_available)
result = vacancy_query.all_with_contact(limit: PAGINATION_LIMIT,
page: page || 1,
remote_available: remote_available)

Success(result: result, pager: pager)
end
Expand Down
6 changes: 5 additions & 1 deletion spec/core/queries/vacancy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

let(:remote_available) { nil }

before { Fabricate.create(:vacancy, published: published, archived: archived, deleted_at: deleted_at, remote_available: false) }
before do
Fabricate.create(:vacancy, published: published, archived: archived,
deleted_at: deleted_at, remote_available: false)
end

context 'when vacancy published and not archived or deleted' do
let(:published) { true }
Expand All @@ -21,6 +24,7 @@

context 'when remote_available is true' do
let(:remote_available) { true }

it { expect(subject).to eq([]) }
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/vacancies/operations/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
end

context 'with remote query' do
let(:vacancies) { [] }

subject { operation.call(remote_query: remote_query) }

let(:vacancies) { [] }

context 'when remote_query nil' do
let(:remote_query) { nil }

Expand Down

0 comments on commit f2e7cb0

Please sign in to comment.