Skip to content

Commit

Permalink
make rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
fiveNinePlusR committed Sep 30, 2024
1 parent 3859c13 commit eaa7c30
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions app/controllers/machines_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ def autocomplete
sanitized_sql = ActiveRecord::Base.sanitize_sql_array([sql, { term: params[:term] }])

results = ActiveRecord::Base.connection.select_all(sanitized_sql)
.map do |m|
name_year = "#{m['name']} (#{m['manufacturer']}, #{m['year']})"
.map do |m|
name_year = "#{m['name']} (#{m['manufacturer']}, #{m['year']})"

{ label: name_year, value: name_year, id: m['id'], group_id: m['machine_group_id'] }
end
{ label: name_year, value: name_year, id: m['id'], group_id: m['machine_group_id'] }
end

end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def map

params[:user_faved] = user.id if user && !params[:user_faved].blank?

if !params[:by_location_id].blank? && loc = Location.where(id: params[:by_location_id]).first
if !params[:by_location_id].blank? && (loc = Location.where(id: params[:by_location_id]).first)
@title_params[:title] = loc.name
location_type = loc.location_type.name + ' - ' unless loc.location_type.nil?
machine_list = ' - ' + loc.machine_names_first_no_year.join(', ') unless loc.machine_names_first_no_year.empty?
Expand All @@ -74,7 +74,7 @@ def region
@location_count = @locations.count
@lmx_count = @region.machines_count

if !params[:by_location_id].blank? && loc = Location.where(id: params[:by_location_id]).first
if !params[:by_location_id].blank? && (loc = Location.where(id: params[:by_location_id]).first)
@title_params[:title] = loc.name
location_type = loc.location_type.name + ' - ' unless loc.location_type.nil?
machine_list = ' - ' + loc.machine_names_first_no_year.join(', ') unless loc.machine_names_first_no_year.empty?
Expand Down
1 change: 0 additions & 1 deletion spec/features/location_machine_xrefs_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@
end

it 'allows case insensitive searches of a region' do

chicago_region = FactoryBot.create(:region, name: 'chicago', full_name: 'Chicago')
FactoryBot.create(:location, id: 23, region: chicago_region, name: 'Chicago Location')

Expand Down
2 changes: 0 additions & 2 deletions spec/features/locations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
before(:each) do
@location = FactoryBot.create(:location, region_id: @region.id, name: 'Cleo')
@machine = FactoryBot.create(:machine, name: 'Bawb')

end

it 'removes a machine from a location' do
Expand Down Expand Up @@ -531,7 +530,6 @@
@user = FactoryBot.create(:user)
login(@user)


@location = FactoryBot.create(:location, region: @region, name: 'Cleo')
end

Expand Down
2 changes: 1 addition & 1 deletion spec/features/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@
visit "/#{@region.name}/high_rollers"
expect(page).to have_title('High Scores')

visit "/map/?by_location_id=1234"
visit '/map/?by_location_id=1234'
expect(page).to have_title('Pinball Map')

visit "/map/?by_location_id=#{@location.id}"
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/api/v1/locations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@
it 'respects no_details and shows fewer location fields' do
lmx = FactoryBot.create(:location_machine_xref, location: @location, machine: FactoryBot.create(:machine, id: 7777, name: 'Cleo'))
FactoryBot.create(:machine_condition, location_machine_xref_id: lmx.id, comment: 'foo bar')
FactoryBot.create(:machine_score_xref, location_machine_xref: lmx, score: 567890)
FactoryBot.create(:machine_score_xref, location_machine_xref: lmx, score: 567_890)
get "/api/v1/locations/#{@location.id}.json", params: { no_details: 1 }

expect(response.body).to include('Satchmo')
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
include Sprockets::Rails::Helper
include ActiveSupport::Testing::TimeHelpers


SimpleCov.start
Coveralls.wear!

Expand Down

0 comments on commit eaa7c30

Please sign in to comment.