Browse Source

lint fixes

pull/81/head
MadeTech Dushan 3 years ago
parent
commit
4a300bf8d2
  1. 2
      app/controllers/case_logs_controller.rb
  2. 2
      config/environments/development.rb
  3. 4
      config/initializers/devise.rb
  4. 1
      db/migrate/20211101103235_devise_create_users.rb
  5. 8
      spec/features/user_spec.rb
  6. 6
      spec/support/devise.rb

2
app/controllers/case_logs_controller.rb

@ -1,7 +1,7 @@
class CaseLogsController < ApplicationController class CaseLogsController < ApplicationController
skip_before_action :verify_authenticity_token, if: :json_api_request? skip_before_action :verify_authenticity_token, if: :json_api_request?
before_action :authenticate, if: :json_api_request? before_action :authenticate, if: :json_api_request?
# TODO determine if it's worth splitting out an API controller # TODO: determine if it's worth splitting out an API controller
before_action :authenticate_user!, unless: :json_api_request? before_action :authenticate_user!, unless: :json_api_request?
def index def index

2
config/environments/development.rb

@ -38,7 +38,7 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log

4
config/initializers/devise.rb

@ -24,7 +24,7 @@ Devise.setup do |config|
# Configure the e-mail address which will be shown in Devise::Mailer, # Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class # note that it will be overwritten if you use your own mailer class
# with default "from" parameter. # with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
# Configure the class responsible to send e-mails. # Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer' # config.mailer = 'Devise::Mailer'
@ -36,7 +36,7 @@ Devise.setup do |config|
# Load and configure the ORM. Supports :active_record (default) and # Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be # :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems. # available as additional gems.
require 'devise/orm/active_record' require "devise/orm/active_record"
# ==> Configuration for any authentication mechanism # ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is # Configure which keys are used when authenticating a user. The default is

1
db/migrate/20211101103235_devise_create_users.rb

@ -32,7 +32,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[6.1]
# t.string :unlock_token # Only if unlock strategy is :email or :both # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps null: false t.timestamps null: false
end end

8
spec/features/user_spec.rb

@ -15,4 +15,12 @@ RSpec.describe "User Features" do
expect(page).to have_current_path("/case_logs") expect(page).to have_current_path("/case_logs")
end end
end end
context "A user who has forgotten their password" do
it " is redirected to the forgotten password page when they click the forgot password link" do
visit("/case_logs")
click_link("Forgot your password?")
expect(page).to have_current_path("/users/password/new")
end
end
end end

6
spec/support/devise.rb

@ -1,9 +1,9 @@
require_relative './controller_macros' require_relative "./controller_macros"
RSpec.configure do |config| RSpec.configure do |config|
# For Devise > 4.1.1 # For Devise > 4.1.1
config.include Devise::Test::ControllerHelpers, :type => :controller config.include Devise::Test::ControllerHelpers, type: :controller
# Use the following instead if you are on Devise <= 4.1.1 # Use the following instead if you are on Devise <= 4.1.1
# config.include Devise::TestHelpers, :type => :controller # config.include Devise::TestHelpers, :type => :controller
config.extend ControllerMacros, :type => :controller config.extend ControllerMacros, type: :controller
end end

Loading…
Cancel
Save