Skip to content

Commit

Permalink
Fix RuboCop errors (#692)
Browse files Browse the repository at this point in the history
* Fix rubocop errors

* Fix rubocop-rspec errors, enabling to infer spec type from file location
  • Loading branch information
mmx900 authored May 5, 2024
1 parent 747d92f commit 994fe48
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/base.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TODO autoloading order changed. This should be managed by configs instead:
# TODO: autoloading order changed. This should be managed by configs instead:
# https://guides.rubyonrails.org/v7.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots
require_relative 'restrooms'

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/restrooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def index
end
end

def show; end

# rubocop:disable Metrics/MethodLength
def new
if params[:edit_id]
Expand All @@ -33,7 +35,7 @@ def new
end
# rubocop:enable Metrics/MethodLength

def show; end
def edit; end

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
Expand Down Expand Up @@ -69,8 +71,6 @@ def create
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

def edit; end

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def update
Expand Down
2 changes: 1 addition & 1 deletion spec/api/v1/restrooms_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe "Restrooms API", type: :request do
describe API::V1::Restrooms do
it 'sends a list of restrooms order by date descending' do
create_list(:restroom, 15)

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/pages_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe PagesController, type: :controller do
describe PagesController do
it_behaves_like 'localized request', :index

it "#index" do
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/restrooms_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe RestroomsController, type: :controller do
describe RestroomsController do
it_behaves_like 'localized request', :index

it "#index" do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/contacts_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'the contact process', type: :feature do
describe 'the contact process' do
it 'shows a generic contact when contact is not from restroom form' do
restroom = create(:restroom, name: "Mission Creek Cafe")

Expand Down
10 changes: 5 additions & 5 deletions spec/features/restrooms_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'restrooms', type: :feature, js: true do
describe 'restrooms', :js do
describe 'submission' do
it 'adds a restroom when submitted' do
visit root_path
Expand Down Expand Up @@ -47,7 +47,7 @@

visit root_path
fill_in 'search', with: 'San Francisco'
click_on 'Search'
click_button 'Search'

expect(page).to have_content 'Mission Creek Cafe'
end
Expand All @@ -57,7 +57,7 @@

visit root_path
mock_location "Oakland"
click_on 'Search by Current Location'
click_button 'Search by Current Location'

expect(page).not_to have_content 'Some Cafe'
end
Expand Down Expand Up @@ -99,7 +99,7 @@
fill_in "restroom[state]", with: "British Columbia"
find(:select, "Country").first(:option, "Canada").select_option

click_on "Preview"
click_button "Preview"

page.has_css?(".nearby-container .listItem", visible: :visible)
end
Expand Down Expand Up @@ -136,7 +136,7 @@
click_link "Propose an edit to this listing."

fill_in "restroom[directions]", with: "This is an edit"
click_on "Save Restroom"
click_button "Save Restroom"

expect(page).to have_content("Your edit has been submitted.")
expect(Restroom.where(edit_id: restroom.id).size).to eq(2)
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
# config.mock_with :rr

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.fixture_path = Rails.root.join("/spec/fixtures")

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true

config.infer_spec_type_from_file_location!

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
Expand Down
2 changes: 1 addition & 1 deletion spec/support/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# spec/spec_helper.rb
#

require_relative './locations'
require_relative 'locations'

Capybara.javascript_driver = :cuprite
Capybara.register_driver(:cuprite) do |app|
Expand Down

0 comments on commit 994fe48

Please sign in to comment.