Browse Source

Rubocop

pull/81/head
baarkerlounger 3 years ago
parent
commit
c607458783
  1. 1
      app/controllers/case_logs_controller.rb
  2. 1
      lib/tasks/form_definition.rake
  3. 42
      spec/requests/users/passwords_controller_spec.rb

1
app/controllers/case_logs_controller.rb

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

1
lib/tasks/form_definition.rake

@ -1,6 +1,5 @@
require "json"
require "json-schema"
# rubocop:disable Lint/ShadowingOuterLocalVariable
def get_all_form_paths(directories)
form_paths = []
directories.each do |directory|

42
spec/requests/users/passwords_controller_spec.rb

@ -2,32 +2,32 @@ require "rails_helper"
require_relative "../../support/devise"
RSpec.describe Users::PasswordsController, type: :request do
let(:params) { { user: { email: email } } }
let(:params) { { user: { email: email } } }
context "when a password reset is requested for a valid email" do
let(:user) { FactoryBot.create(:user) }
let(:email) { user.email }
context "when a password reset is requested for a valid email" do
let(:user) { FactoryBot.create(:user) }
let(:email) { user.email }
it "redirects to the email sent page anyway" do
post "/users/password", params: params
expect(response).to have_http_status(:redirect)
follow_redirect!
expect(response.body).to match(/Check your email/)
end
it "redirects to the email sent page anyway" do
post "/users/password", params: params
expect(response).to have_http_status(:redirect)
follow_redirect!
expect(response.body).to match(/Check your email/)
end
end
context "when a password reset is requested with an email that doesn't exist in the system" do
before do
allow_any_instance_of(Users::PasswordsController).to receive(:is_navigational_format?).and_return(false)
end
context "when a password reset is requested with an email that doesn't exist in the system" do
before do
allow_any_instance_of(Users::PasswordsController).to receive(:is_navigational_format?).and_return(false)
end
let(:email) { "madeup_email@test.com" }
let(:email) { "madeup_email@test.com" }
it "redirects to the email sent page anyway" do
post "/users/password", params: params
expect(response).to have_http_status(:redirect)
follow_redirect!
expect(response.body).to match(/Check your email/)
end
it "redirects to the email sent page anyway" do
post "/users/password", params: params
expect(response).to have_http_status(:redirect)
follow_redirect!
expect(response.body).to match(/Check your email/)
end
end
end

Loading…
Cancel
Save