generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into EL-1913-filesize
- Loading branch information
Showing
10 changed files
with
256 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
class CompletedUserJourney < ApplicationRecord | ||
end | ||
|
||
#------------------------------------------------------------------------------ | ||
#---------------------------------------------------------------------------------- | ||
# CompletedUserJourney | ||
# | ||
# Name SQL Type Null Primary Default | ||
# -------------------- -------------------- ------- ------- ---------- | ||
# id bigint false true | ||
# assessment_id character varying false false | ||
# certificated boolean false false | ||
# partner boolean false false | ||
# person_over_60 boolean false false | ||
# passported boolean false false | ||
# main_dwelling_owned boolean true false | ||
# vehicle_owned boolean true false | ||
# smod_assets boolean true false | ||
# outcome character varying false false | ||
# capital_contribution boolean true false | ||
# income_contribution boolean false false | ||
# completed date true false | ||
# form_downloaded boolean true false false | ||
# matter_type character varying true false | ||
# asylum_support boolean true false | ||
# client_age character varying true false | ||
# session jsonb true false | ||
# office_code character varying true false | ||
# early_result_type character varying true false | ||
# Name SQL Type Null Primary Default | ||
# -------------------- -------------------- ------- ------- ---------- | ||
# id bigint false true | ||
# assessment_id character varying false false | ||
# certificated boolean false false | ||
# partner boolean false false | ||
# person_over_60 boolean false false | ||
# passported boolean false false | ||
# main_dwelling_owned boolean true false | ||
# vehicle_owned boolean true false | ||
# smod_assets boolean true false | ||
# outcome character varying false false | ||
# capital_contribution boolean true false | ||
# income_contribution boolean false false | ||
# completed date true false | ||
# form_downloaded boolean true false false | ||
# matter_type character varying true false | ||
# asylum_support boolean true false | ||
# client_age character varying true false | ||
# session jsonb true false | ||
# office_code character varying true false | ||
# early_result_type character varying true false | ||
# early_eligibility_result boolean false false | ||
# | ||
#------------------------------------------------------------------------------ | ||
#---------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
db/migrate/20241105100606_change_assessment_id_in_completed_user_journeys.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class ChangeAssessmentIdInCompletedUserJourneys < ActiveRecord::Migration[7.2] | ||
def change | ||
remove_index :completed_user_journeys, column: :assessment_id, unique: true | ||
add_index :completed_user_journeys, :assessment_id, unique: false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe ResultsController, type: :controller do | ||
include Devise::Test::ControllerHelpers | ||
|
||
let(:email_address) { "test@testing.com" } | ||
let(:assessment_code) { "123456" } | ||
let(:session_data) { { "some" => "data", "assessment_code" => assessment_code } } | ||
let(:calculation_result) { instance_double(CalculationResult) } | ||
let(:check) { instance_double(Check, controlled?: false, early_ineligible_result?: false) } | ||
|
||
before do | ||
OmniAuth.config.mock_auth[:saml] = build(:mock_saml_auth) | ||
provider = create(:provider, email: email_address, first_office_code: "1Q630KL") | ||
sign_in provider | ||
|
||
allow(controller).to receive(:session_data).and_return(session_data) | ||
allow(CalculationResult).to receive(:new).and_return(calculation_result) | ||
allow(Check).to receive(:new).and_return(check) | ||
allow(controller).to receive(:track_page_view) | ||
end | ||
|
||
describe "GET #show" do | ||
context "when @check.early_ineligible_result? is true", :ee_banner do | ||
before do | ||
allow(check).to receive(:early_ineligible_result?).and_return(true) | ||
end | ||
|
||
it "does not call JourneyLoggerService" do | ||
expect(JourneyLoggerService).not_to receive(:call) | ||
get :show, params: { assessment_code: } | ||
end | ||
end | ||
|
||
context "when @check.early_ineligible_result? is false", :ee_banner do | ||
before do | ||
allow(check).to receive(:early_ineligible_result?).and_return(false) | ||
end | ||
|
||
it "calls JourneyLoggerService" do | ||
expect(JourneyLoggerService).to receive(:call).with(any_args) | ||
get :show, params: { assessment_code: } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters