Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aamircodes committed Mar 19, 2024
1 parent 901073e commit d3f0b9b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
4 changes: 2 additions & 2 deletions app/controllers/token_based_resume_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class TokenBasedResumeController < ApplicationController

def session_expired
@application = UnaccompaniedMinor.find_by_reference(session[:app_reference])
if @application && !@application.email.blank?

if @application && @application.email.present?
send_email
else
Rails.logger.info "User hasn't created any account yet and the session has timed out due to inactivity."
Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/token_based_resume_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
end

describe "User session times out before creating an account" do

given_name = "".freeze
email = nil

Expand Down Expand Up @@ -76,8 +75,6 @@

expect(Rails.logger).to have_received(:info).with("User hasn't created any account yet and the session has timed out due to inactivity.")
end


end

describe "User tries to resume their application after email sent" do
Expand Down
37 changes: 18 additions & 19 deletions spec/system/token_based_resume_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
require "rails_helper"

RSpec.describe TokenBasedResumeController, type: :system do
let(:spencer_scrambled) { "s**************@example.com" }
let(:email_scrambled) { "t***@example.com" }
let(:email) { "test@example.com" }
let(:uam) { UnaccompaniedMinor.new }
let(:expiry_time) { Time.zone.now.utc + 1.hour }
let(:magic_id) { "e5c4fe58-a8ca-4e6f-aaa6-7e0a381eb3dc" }
let(:created_at) { Time.zone.now.utc }
let(:already_expired) { Time.zone.now.utc - 1.hour }
let(:sms_code) { 123_456 }
let(:task_list_content) { "Apply for approval to provide a safe home for a child from Ukraine" }
let(:application_token) { instance_double("ApplicationToken") }
let(:texter) { instance_double("Notifications::Client") }

before do
driven_by(:rack_test_user_agent)
allow(Notifications::Client).to receive(:new).and_return(texter)
allow(texter).to receive(:send_sms)
end

describe "User hasn't created an account and has been timed out" do
let(:email) { nil }
Expand All @@ -18,25 +36,6 @@
end
end

let(:texter) { instance_double("Notifications::Client") }
let(:application_token) { instance_double("ApplicationToken") }
let(:task_list_content) { "Apply for approval to provide a safe home for a child from Ukraine" }
let(:sms_code) { 123_456 }
let(:already_expired) { Time.zone.now.utc - 1.hour }
let(:created_at) { Time.zone.now.utc }
let(:magic_id) { "e5c4fe58-a8ca-4e6f-aaa6-7e0a381eb3dc" }
let(:expiry_time) { Time.zone.now.utc + 1.hour }
let(:uam) { UnaccompaniedMinor.new }
let(:email) { "test@example.com" }
let(:email_scrambled) { "t***@example.com" }
let(:spencer_scrambled) { "s**************@example.com" }

before do
driven_by(:rack_test_user_agent)
allow(Notifications::Client).to receive(:new).and_return(texter)
allow(texter).to receive(:send_sms)
end

describe "User has been timed out" do
it "shows time out page and copy" do
new_application = UnaccompaniedMinor.new
Expand Down

0 comments on commit d3f0b9b

Please sign in to comment.