source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/opponents/individual_form_spec.rb | Ruby | mit | 19 | main | 2,791 | require "rails_helper"
RSpec.describe Opponents::IndividualForm, type: :form do
subject(:name_form) { described_class.new(form_params) }
let(:form_params) do
{
"first_name" => "Bob",
"last_name" => "Smith",
"legal_aid_application" => legal_aid_application,
"model" => opponent,
}
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/opponents/domestic_abuse_summary_form_spec.rb | Ruby | mit | 19 | main | 5,971 | require "rails_helper"
module Providers
module ApplicationMeritsTask
RSpec.describe DomesticAbuseSummaryForm, type: :form do
subject(:das_form) { described_class.new(form_params) }
let(:params) do
{
"warning_letter_sent" => "false",
"warning_letter_sent_details" => "New w... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/opponents/organisation_form_spec.rb | Ruby | mit | 19 | main | 2,825 | require "rails_helper"
RSpec.describe Opponents::OrganisationForm, :vcr, type: :form do
subject(:organisation_form) { described_class.new(form_params) }
let(:form_params) do
{
"name" => "Central Beds Council",
"organisation_type_ccms_code" => "LA",
"legal_aid_application" => legal_aid_applic... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/partners/contrary_interests_form_spec.rb | Ruby | mit | 19 | main | 3,873 | require "rails_helper"
RSpec.describe Partners::ContraryInterestsForm, type: :form do
subject(:contrary_interest_form) { described_class.new(params) }
let(:applicant) { create(:applicant, partner_has_contrary_interest: contrary_interest) }
let(:contrary_interest) { nil }
let(:params) do
{
partner_h... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/partners/details_form_spec.rb | Ruby | mit | 19 | main | 8,397 | require "rails_helper"
RSpec.describe Partners::DetailsForm, type: :form do
subject(:partner_form) { described_class.new(params) }
let(:legal_aid_application) { create(:legal_aid_application) }
let(:params) do
{
first_name:,
last_name: "Snow",
date_of_birth_3i: date_of_birth&.day&.to_s,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/partners/client_has_partner_form_spec.rb | Ruby | mit | 19 | main | 3,360 | require "rails_helper"
RSpec.describe Partners::ClientHasPartnerForm, type: :form do
subject(:client_partner_form) { described_class.new(params) }
let(:applicant) { create(:applicant, has_partner: applicant_has_partner) }
let(:applicant_has_partner) { nil }
let(:params) do
{
has_partner:,
mod... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/partners/student_finance_form_spec.rb | Ruby | mit | 19 | main | 6,922 | require "rails_helper"
RSpec.describe Partners::StudentFinanceForm, type: :form do
subject(:instance) { described_class.new(params) }
let(:partner) { create(:partner, student_finance: nil, student_finance_amount: nil) }
let(:legal_aid_application) { create(:legal_aid_application, partner:) }
describe ".model... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/partners/offline_accounts_form_spec.rb | Ruby | mit | 19 | main | 6,750 | require "rails_helper"
RSpec.describe Partners::OfflineAccountsForm, type: :form do
subject(:described_form) { described_class.new(form_params) }
let(:savings_amount) { create(:savings_amount) }
let(:attributes) { described_class::ATTRIBUTES }
let(:check_box_attributes) { described_class::CHECK_BOXES_ATTRIBUT... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/partners/employed_form_spec.rb | Ruby | mit | 19 | main | 2,055 | require "rails_helper"
RSpec.describe Partners::EmployedForm, type: :form do
subject(:form) { described_class.new(form_params) }
let(:application) { create(:legal_aid_application, partner:) }
let(:partner) { create(:partner, employed: nil) }
let(:params) { { employed: true } }
let(:form_params) { params.me... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/incidents/when_contact_was_made_form_spec.rb | Ruby | mit | 19 | main | 3,066 | require "rails_helper"
RSpec.describe Incidents::WhenContactWasMadeForm, type: :form do
subject(:described_form) { described_class.new(params.merge(model: incident)) }
let(:incident) { create(:incident) }
let(:first_contact_date) { 5.days.ago.to_date }
let(:i18n_scope) { "activemodel.errors.models.application... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/incidents/told_on_form_spec.rb | Ruby | mit | 19 | main | 5,159 | require "rails_helper"
RSpec.describe Incidents::ToldOnForm, type: :form do
subject(:form) { described_class.new(params.merge(model: incident)) }
let(:incident) { create(:incident) }
let(:params) { { occurred_on: occurred_on_string, told_on: told_on_string } }
let(:told_on_string) { 3.days.ago.to_date.to_s(:... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/emergency_defaults_form_spec.rb | Ruby | mit | 19 | main | 23,697 | require "rails_helper"
def da001_applicant_with_df
{
success: true,
requested_params: {
proceeding_type_ccms_code: "DA001",
delegated_functions_used: true,
client_involvement_type: "A",
},
default_level_of_service: {
level: 3,
name: "Full Representation",
stage: 8,... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/final_hearing_form_spec.rb | Ruby | mit | 19 | main | 4,752 | require "rails_helper"
module Proceedings
RSpec.describe FinalHearingForm do
subject(:form) { described_class.new(params) }
let(:params) do
{
work_type:,
listed:,
date:,
details:,
proceeding_id:,
}
end
let(:work_type) { :substantive }
let(:lis... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/substantive_defaults_form_spec.rb | Ruby | mit | 19 | main | 6,129 | require "rails_helper"
RSpec.describe Proceedings::SubstantiveDefaultsForm, :vcr, type: :form do
subject(:form) { described_class.new(form_params) }
let(:proceeding) { create(:proceeding, :da001, :without_df_date, :with_cit_z, no_scope_limitations: true) }
let(:params) do
{
accepted_substantive_defaul... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/delegated_functions_form_spec.rb | Ruby | mit | 19 | main | 7,623 | require "rails_helper"
RSpec.describe Proceedings::DelegatedFunctionsForm, type: :form do
subject(:form) { described_class.new(form_params) }
let(:proceeding) { create(:proceeding, :da001) }
let(:form_params) { params.merge(model: proceeding) }
let(:params) do
{
used_delegated_functions: used_df?,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/scope_limitations_form_spec.rb | Ruby | mit | 19 | main | 8,800 | require "rails_helper"
RSpec.describe Proceedings::ScopeLimitationsForm, :vcr, type: :form do
subject(:form) { described_class.call(scopes, model: proceeding, scope_type: scope_type.to_s) }
let(:scopes) do
[{ "code" => "FM007", "meaning" => "Blood Tests or DNA Tests", "description" => "Limited to all steps up... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/emergency_level_of_service_form_spec.rb | Ruby | mit | 19 | main | 3,627 | require "rails_helper"
RSpec.describe Proceedings::EmergencyLevelOfServiceForm, :vcr, type: :form do
subject(:form) { described_class.new(form_params) }
let(:proceeding) do
create(:proceeding,
:se014,
:without_df_date,
:with_cit_z,
emergency_level_of_service: nil,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/client_involvement_type_form_spec.rb | Ruby | mit | 19 | main | 1,024 | require "rails_helper"
RSpec.describe Proceedings::ClientInvolvementTypeForm, :vcr, type: :form do
subject(:cit_form) { described_class.new(form_params) }
let(:proceeding) { create(:proceeding, :da001, :with_cit_z) }
let(:params) do
{
client_involvement_type_ccms_code: cit,
}
end
let(:form_par... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/proceedings/substantive_level_of_service_form_spec.rb | Ruby | mit | 19 | main | 3,687 | require "rails_helper"
RSpec.describe Proceedings::SubstantiveLevelOfServiceForm, :vcr, type: :form do
subject(:form) { described_class.new(form_params) }
let(:proceeding) do
create(:proceeding,
:se014,
:without_df_date,
:with_cit_z,
substantive_level_of_service: ni... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/vehicles/details_form_spec.rb | Ruby | mit | 19 | main | 4,595 | require "rails_helper"
RSpec.describe Vehicles::DetailsForm, :vcr, type: :form do
subject(:vehicle_details_form) { described_class.new(form_params) }
let(:model) { create(:vehicle, :with_applicant_and_partner) }
let(:params) do
{
estimated_value:,
more_than_three_years_old:,
owner:,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/savings_amounts/offline_accounts_form_spec.rb | Ruby | mit | 19 | main | 8,825 | require "rails_helper"
RSpec.describe SavingsAmounts::OfflineAccountsForm, type: :form do
subject(:described_form) { described_class.new(form_params) }
let(:savings_amount) { create(:savings_amount) }
let(:attributes) { described_class::ATTRIBUTES }
let(:check_box_attributes) { described_class::CHECK_BOXES_AT... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/savings_amounts/savings_amounts_form_spec.rb | Ruby | mit | 19 | main | 7,628 | require "rails_helper"
RSpec.describe SavingsAmounts::SavingsAmountsForm, type: :form do
subject(:described_form) { described_class.new(form_params) }
let(:savings_amount) { create(:savings_amount) }
let(:attributes) { described_class::ATTRIBUTES }
let(:check_box_attributes) { described_class::CHECK_BOXES_ATT... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/addresses/address_form_spec.rb | Ruby | mit | 19 | main | 4,374 | require "rails_helper"
RSpec.describe Addresses::AddressForm, type: :form do
subject(:form) { described_class.new(address_params.merge(model: address)) }
let(:address_line_one) { "Ministry Of Justice" }
let(:address_line_two) { "102 Petty France" }
let(:address_line_three) { "" }
let(:city) { "London" }
l... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/addresses/address_selection_form_spec.rb | Ruby | mit | 19 | main | 846 | require "rails_helper"
RSpec.describe Addresses::AddressSelectionForm, type: :form do
subject(:form) { described_class.new(form_params.merge(model: applicant)) }
let(:postcode) { "SW1H 9EA" }
let(:lookup_id) { "123456" }
let(:applicant) { create(:applicant) }
let(:form_params) do
{
lookup_id:,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/addresses/address_lookup_form_spec.rb | Ruby | mit | 19 | main | 1,523 | require "rails_helper"
RSpec.describe Addresses::AddressLookupForm, type: :form do
subject(:form) { described_class.new(params) }
let(:postcode) { "SW1H9AJ" }
let(:address) { build(:address) }
let(:params) { { postcode:, model: address } }
describe "validations" do
it "has no errors with normal postcod... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/addresses/choice_form_spec.rb | Ruby | mit | 19 | main | 2,901 | require "rails_helper"
RSpec.describe Addresses::ChoiceForm, type: :form do
subject(:form) { described_class.new(form_params.merge(model: applicant)) }
let(:correspondence_address_choice) { "home" }
let(:applicant) { create(:applicant) }
let(:form_params) do
{
correspondence_address_choice:,
}
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/addresses/care_of_form_spec.rb | Ruby | mit | 19 | main | 7,353 | require "rails_helper"
RSpec.describe Addresses::CareOfForm, type: :form do
subject(:instance) { described_class.new(params) }
let(:address) { create(:address, location: "correspondence") }
let(:care_of) { "no" }
let(:params) do
{
model: address,
care_of:,
care_of_first_name:,
car... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/addresses/non_uk_home_address_form_spec.rb | Ruby | mit | 19 | main | 4,263 | require "rails_helper"
RSpec.describe Addresses::NonUkHomeAddressForm, :vcr, type: :form do
subject(:form) { described_class.new(address_params.merge(model: address)) }
let(:country_code) { "CHN" }
let(:country_name) { "China" }
let(:address_line_one) { "Maple Leaf Education Building" }
let(:address_line_tw... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/applicants/student_finance_form_spec.rb | Ruby | mit | 19 | main | 6,981 | require "rails_helper"
RSpec.describe Applicants::StudentFinanceForm, type: :form do
subject(:instance) { described_class.new(params) }
let(:applicant) { create(:applicant, student_finance: nil, student_finance_amount: nil) }
let(:legal_aid_application) { create(:legal_aid_application, applicant:) }
describe... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/applicants/previous_reference_form_spec.rb | Ruby | mit | 19 | main | 6,053 | require "rails_helper"
RSpec.describe Applicants::PreviousReferenceForm, type: :form do
subject(:instance) { described_class.new(params) }
let(:applicant) { create(:applicant, applied_previously: nil, previous_reference: nil) }
let(:legal_aid_application) { create(:legal_aid_application, applicant:) }
let(:p... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/applicants/email_form_spec.rb | Ruby | mit | 19 | main | 1,341 | require "rails_helper"
RSpec.describe Applicants::EmailForm, type: :form do
subject(:described_form) { described_class.new(params) }
let(:params) do
{
email:,
model: applicant,
}
end
let(:legal_aid_application) { create(:legal_aid_application, applicant:) }
let(:applicant) { create(:appl... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/applicants/has_national_insurance_number_form_spec.rb | Ruby | mit | 19 | main | 8,037 | require "rails_helper"
RSpec.describe Applicants::HasNationalInsuranceNumberForm, type: :form do
subject(:instance) { described_class.new(params) }
let(:applicant) { create(:applicant, has_national_insurance_number: nil, national_insurance_number: nil) }
let(:legal_aid_application) { create(:legal_aid_applicati... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/applicants/employed_form_spec.rb | Ruby | mit | 19 | main | 2,068 | require "rails_helper"
RSpec.describe Applicants::EmployedForm, type: :form do
subject(:form) { described_class.new(form_params) }
let(:applicant) { create(:applicant, employed: nil) }
let(:params) { { employed: true } }
let(:form_params) { params.merge(model: applicant) }
describe "#initialize" do
con... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/applicants/basic_details_form_spec.rb | Ruby | mit | 19 | main | 11,705 | require "rails_helper"
RSpec.describe Applicants::BasicDetailsForm, type: :form do
subject(:form) { described_class.new(params) }
let(:params) { attributes.slice(*attr_list).merge(model: legal_aid_application.build_applicant, changed_last_name: "false") }
let(:attr_list) do
%i[
first_name
last_n... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/concerns/date_field_builder_spec.rb | Ruby | mit | 19 | main | 4,061 | require "rails_helper"
ModelStruct = Struct.new(:happened_on)
FormStruct = Struct.new(:happened_day, :happened_month, :happened_year)
SuffixedFormStruct = Struct.new(:happened_3i, :happened_2i, :happened_1i)
RSpec.describe DateFieldBuilder do
subject(:date_field_builder) do
described_class.new(
form:,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/substantive_application_form_spec.rb | Ruby | mit | 19 | main | 1,480 | require "rails_helper"
RSpec.describe LegalAidApplications::SubstantiveApplicationForm, type: :form do
subject(:described_form) { described_class.new(params) }
let(:used_delegated_functions_on) { 1.day.ago.to_date }
let(:application) do
create(:legal_aid_application, :applicant_details_checked)
end
let(... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/confirm_separate_representation_form_spec.rb | Ruby | mit | 19 | main | 2,093 | require "rails_helper"
RSpec.describe LegalAidApplications::ConfirmSeparateRepresentationForm do
subject(:form) { described_class.new(params) }
describe "#save" do
let(:legal_aid_application) { create(:legal_aid_application, separate_representation_required: nil) }
before do
form.save
end
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/own_home_form_spec.rb | Ruby | mit | 19 | main | 3,223 | require "rails_helper"
RSpec.describe LegalAidApplications::OwnHomeForm, type: :form do
subject(:described_form) { described_class.new(params.merge(model: application)) }
let(:application) { create(:legal_aid_application, :with_applicant_and_address) }
let(:params) { { own_home: "mortgage" } }
describe "#va... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/emergency_cost_override_form_spec.rb | Ruby | mit | 19 | main | 8,224 | require "rails_helper"
RSpec.describe LegalAidApplications::EmergencyCostOverrideForm do
subject(:form) { described_class.new(form_params) }
describe "validation" do
subject(:valid?) { form.valid? }
let(:legal_aid_application) { create(:legal_aid_application, :with_applicant_and_address) }
let(:form_... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/confirm_client_declaration_form_spec.rb | Ruby | mit | 19 | main | 1,636 | require "rails_helper"
RSpec.describe LegalAidApplications::ConfirmClientDeclarationForm do
subject(:form) { described_class.new(params) }
describe "#validates" do
context "when the client declaration is confirmed" do
let(:params) { { client_declaration_confirmed: true } }
it { is_expected.to be_... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/dependant_form_spec.rb | Ruby | mit | 19 | main | 5,486 | require "rails_helper"
RSpec.describe LegalAidApplications::DependantForm, type: :form do
subject(:described_form) { described_class.new(params) }
let(:dependant) { create(:dependant, date_of_birth: nil) }
let(:date) { Faker::Date.birthday }
let(:day) { date.strftime("%d") } # Two number day
let(:month) { d... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/property_details_form_spec.rb | Ruby | mit | 19 | main | 3,575 | require "rails_helper"
RSpec.describe LegalAidApplications::PropertyDetailsForm, type: :form do
subject(:described_form) { described_class.new(params.merge(model: legal_aid_application)) }
let(:legal_aid_application) { create(:legal_aid_application, :with_applicant_and_address) }
let(:params) do
{
pr... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/restrictions_form_spec.rb | Ruby | mit | 19 | main | 2,340 | require "rails_helper"
RSpec.describe LegalAidApplications::RestrictionsForm, type: :form do
subject(:described_form) { described_class.new(form_params) }
let(:application) { create(:legal_aid_application, :with_applicant) }
let(:restrictions_details) { Faker::Lorem.paragraph }
let(:has_restrictions) { "true"... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/forms/legal_aid_applications/has_evidence_of_benefit_form_spec.rb | Ruby | mit | 19 | main | 694 | require "rails_helper"
RSpec.describe LegalAidApplications::HasEvidenceOfBenefitForm do
subject(:described_form) { described_class.new(params.merge(model: dwp_override)) }
let(:dwp_override) { create(:dwp_override, passporting_benefit: "Universal Credit") }
let(:has_evidence_of_benefit) { true }
let(:params) ... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/money_helper_spec.rb | Ruby | mit | 19 | main | 4,420 | require "rails_helper"
RSpec.describe MoneyHelper do
subject(:humanized_balance) { value_with_currency_unit(balance, currency) }
let(:balance) { 325.42 }
describe "#display_value_with_symbol" do
context "when the currency is GBP" do
let(:currency) { "GBP" }
it { is_expected.to eq("£#{balance}"... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/uploaded_evidence_helper_spec.rb | Ruby | mit | 19 | main | 2,107 | require "rails_helper"
RSpec.describe UploadedEvidenceHelper do
before do
DocumentCategoryPopulator.call
end
describe ".evidence_message" do
subject(:evidence_message) { helper.evidence_message(legal_aid_application, evidence_type_translation) }
let(:legal_aid_application) { create(:legal_aid_appli... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/transaction_type_helper_spec.rb | Ruby | mit | 19 | main | 16,475 | require "rails_helper"
RSpec.describe TransactionTypeHelper do
let(:legal_aid_application) { create(:legal_aid_application) }
let(:owner_type) { "Applicant" }
describe "#answer_for_transaction_type" do
subject do
transaction_type = instance_double(TransactionType, id: "a-stubbed-uuid")
helper.a... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/address_helper_spec.rb | Ruby | mit | 19 | main | 1,019 | require "rails_helper"
RSpec.describe AddressHelper do
describe ".address_with_line_breaks" do
subject(:address_with_line_breaks) { helper.address_with_line_breaks(address) }
let(:address) { create(:address) }
context "when address is nil" do
let(:address) { nil }
it { is_expected.to be_ni... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/application_helper_spec.rb | Ruby | mit | 19 | main | 3,483 | require "rails_helper"
RSpec.describe ApplicationHelper do
helper do
def provider_signed_in?
signed_in
end
def admin_user_signed_in?
signed_in
end
def current_provider
provider
end
def current_journey
journey_type
end
end
let(:header) { MojComponent::He... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/has_other_proceedings_helper_spec.rb | Ruby | mit | 19 | main | 1,911 | require "rails_helper"
RSpec.describe HasOtherProceedingsHelper do
let(:output) do
[
instance_double(LegalFramework::ProceedingTypes::All::ProceedingTypeStruct, ccms_code: "SE004", ccms_matter_code: "KSEC8", meaning: "Specific issue order"),
instance_double(LegalFramework::ProceedingTypes::All::Proce... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/transaction_period_helper_spec.rb | Ruby | mit | 19 | main | 532 | require "rails_helper"
RSpec.describe TransactionPeriodHelper do
let(:application) { create(:legal_aid_application, transaction_period_start_on: "Thu, 21 Oct 2020", transaction_period_finish_on: "Thu, 21 Jan 2021") }
describe "#date_from(application)" do
it "returns a valid date" do
expect(helper.date_f... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/ineligible_reasons_helper_spec.rb | Ruby | mit | 19 | main | 2,044 | require "rails_helper"
RSpec.describe IneligibleReasonsHelper do
let(:eligible_result) { create(:cfe_v6_result) }
let(:ineligible_gross_income_result) { create(:cfe_v6_result, :ineligible_gross_income) }
let(:ineligible_disposable_income_result) { create(:cfe_v6_result, :ineligible_disposable_income) }
let(:in... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/state_benefit_partial_url_helper_spec.rb | Ruby | mit | 19 | main | 521 | require "rails_helper"
RSpec.describe StateBenefitPartialUrlHelper do
let(:legal_aid_application) { create(:legal_aid_application) }
let(:transaction) { create(:regular_transaction, legal_aid_application:) }
describe ".state_benefit_partial_url" do
subject(:helper_method) { state_benefit_partial_url(:fake, ... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/check_provider_answers_helper_spec.rb | Ruby | mit | 19 | main | 2,413 | require "rails_helper"
RSpec.describe CheckProviderAnswersHelper do
let(:legal_aid_application) { create(:legal_aid_application, applicant:) }
let(:applicant) { create(:applicant, address:, same_correspondence_and_home_address:, no_fixed_residence:, correspondence_address_choice:) }
let(:same_correspondence_and_... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/dwp_outcome_helper_spec.rb | Ruby | mit | 19 | main | 1,340 | require "rails_helper"
RSpec.describe DWPOutcomeHelper do
let(:application) { create(:legal_aid_application) }
describe "#reset_confirm_dwp_status" do
subject(:call_method) { helper.reset_confirm_dwp_status!(application) }
before { call_method }
let(:application) { create(:legal_aid_application, dwp... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/capital_helper_spec.rb | Ruby | mit | 19 | main | 598 | require "rails_helper"
RSpec.describe CapitalHelper do
describe ".capital_amount_text" do
subject(:capital_amount_text) { helper.capital_amount_text(amount, type) }
let(:amount) { nil }
let(:type) { nil }
context "when amount is nil" do
it { is_expected.to eq "No" }
end
context "when... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/your_applications_helper_spec.rb | Ruby | mit | 19 | main | 327 | require "rails_helper"
RSpec.describe YourApplicationsHelper do
describe "#your_applications_default_tab_path" do
it "returns the path for the default tab on the your applications page" do
expect(helper.your_applications_default_tab_path).to eq(in_progress_providers_legal_aid_applications_path)
end
e... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/policy_disregards_helper_spec.rb | Ruby | mit | 19 | main | 1,828 | require "rails_helper"
RSpec.describe PolicyDisregardsHelper do
include ApplicationHelper
describe "#policy_disregards_hash" do
let(:result) { policy_disregards_list(policy_disregards) }
context "with no disregards selected" do
let(:policy_disregards) { create(:policy_disregards, none_selected: tru... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/hash_format_helper_spec.rb | Ruby | mit | 19 | main | 2,135 | require "rails_helper"
RSpec.describe HashFormatHelper do
let(:source) { { key: "value", sub_hash: { sub_key: "sub_value" }, array_hash: [{ array_one: "array_value" }, { array_two: "array_value" }] } }
let(:expected_response) do
'<dl class="govuk-body kvp govuk-!-margin-bottom-0"><dt>Key</dt><dd>Value</dd></dl... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/flow_helper_spec.rb | Ruby | mit | 19 | main | 2,639 | require "rails_helper"
RSpec.describe FlowHelper do
describe "#next_action_buttons_with_form" do
it "wraps next_action_buttons inside a form_with" do
html = helper.next_action_buttons_with_form(url: "/test-path")
expect(html).to have_css("form[action=\"/test-path\"]")
end
it "includes a cont... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/proceeding_helper_spec.rb | Ruby | mit | 19 | main | 4,523 | require "rails_helper"
RSpec.describe ProceedingHelper do
describe "#position_in_array" do
subject(:array_position) { position_in_array(proceeding) }
context "when an application has two proceedings" do
let(:legal_aid_application) { create(:legal_aid_application, :with_multiple_proceedings_inc_section... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/attachments_helper_spec.rb | Ruby | mit | 19 | main | 1,197 | require "rails_helper"
RSpec.describe AttachmentsHelper do
let(:application) { create(:legal_aid_application) }
describe "#attachments_with_size" do
context "with attachments" do
let!(:statement_of_case) { create(:statement_of_case, :with_original_file_attached, legal_aid_application: application) }
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/dependant_helper_spec.rb | Ruby | mit | 19 | main | 270 | require "rails_helper"
RSpec.describe DependantHelper do
include ApplicationHelper
let(:dependant) { create(:dependant) }
describe "#dependant_hash" do
subject(:dependant_helper) { dependant_hash(dependant) }
it { is_expected.to be_a(Hash) }
end
end |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/capital_disregard_helper_spec.rb | Ruby | mit | 19 | main | 3,858 | require "rails_helper"
RSpec.describe CapitalDisregardHelper do
let(:legal_aid_application) { create(:legal_aid_application) }
let(:create_mandatory_disregards) do
create(
:capital_disregard,
legal_aid_application:,
mandatory: true,
name: "budgeting_advances",
amount: 1001,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/liquid_capital_items_helper_spec.rb | Ruby | mit | 19 | main | 1,668 | require "rails_helper"
RSpec.describe LiquidCapitalItemsHelper do
describe "#capital_items_to_display?" do
subject(:call) { capital_items_to_display?(legal_aid_application, item) }
context "with passported application without online accounts item description" do
let(:legal_aid_application) { create(:l... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/means_report_helper_spec.rb | Ruby | mit | 19 | main | 2,482 | require "rails_helper"
RSpec.describe MeansReportHelper do
let(:legal_aid_application) { build_stubbed(:legal_aid_application, applicant:) }
let(:applicant) { build_stubbed(:applicant) }
shared_examples "transaction type item list" do
it { is_expected.to all(respond_to(:to_h)) }
end
describe "#outgoing... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/task_list_helper_spec.rb | Ruby | mit | 19 | main | 3,054 | require "rails_helper"
RSpec.describe TaskListHelper do
describe "#task_list_includes?" do
subject(:task_list_includes?) { helper.task_list_includes?(legal_aid_application, task_name) }
let(:legal_aid_application) { create(:legal_aid_application, :with_multiple_proceedings_inc_section8) }
let(:task_name... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/time_helper_spec.rb | Ruby | mit | 19 | main | 648 | require "rails_helper"
RSpec.describe TimeHelper do
describe "number_of_days_ago" do
let(:days) { 2 }
before do
new_time = Time.zone.local(2020, 10, 1, 1, 0, 0)
travel_to(new_time)
end
it "returns a valid date" do
expect(helper.number_of_days_ago(days)).to eq "29 9 2020"
end
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/client_helper_spec.rb | Ruby | mit | 19 | main | 1,257 | require "rails_helper"
RSpec.describe ClientHelper do
let(:legal_aid_application) { build_stubbed(:legal_aid_application, applicant:) }
let(:applicant) { build_stubbed(:applicant) }
describe "means_tested_description" do
subject(:means_tested) { means_tested_description(legal_aid_application) }
context... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/check_answer_url_helper_spec.rb | Ruby | mit | 19 | main | 1,371 | require "rails_helper"
RSpec.describe CheckAnswerUrlHelper do
let(:application) { create(:legal_aid_application) }
describe "#check_answer_url_for" do
context "when a provider" do
it "returns the path" do
url = check_answer_url_for(:providers, :own_homes, application)
expect(url).to eq "... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/home_path_helper_spec.rb | Ruby | mit | 19 | main | 1,765 | require "rails_helper"
RSpec.describe HomePathHelper do
include YourApplicationsHelper
describe "#home_path" do
subject { home_path }
context "when on provider journey" do
context "and user is on providers select office page" do
before do
allow(request).to receive(:path).and_retur... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/payments_summary_partial_url_helper_spec.rb | Ruby | mit | 19 | main | 2,467 | require "rails_helper"
RSpec.describe PaymentsSummaryPartialUrlHelper do
let(:application) { create(:legal_aid_application) }
let(:partner) { false }
let(:credit) { false }
let(:regular_payments) { false }
describe ".payments_summary_partial_url" do
subject(:helper_method) { payments_summary_partial_url... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/opponent_helper_spec.rb | Ruby | mit | 19 | main | 2,498 | require "rails_helper"
RSpec.describe OpponentHelper do
let(:legal_aid_application) { create(:legal_aid_application) }
let(:individual_opponent) { create(:opponent, :for_individual, legal_aid_application:) }
let(:organisation_opponent) { create(:opponent, :for_organisation, legal_aid_application:, organisation_n... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/linked_applications_helper_spec.rb | Ruby | mit | 19 | main | 3,294 | require "rails_helper"
RSpec.describe LinkedApplicationsHelper do
describe "#all_linked_applications_details" do
subject(:details) { all_linked_applications_details(legal_aid_application) }
let(:legal_aid_application) { create(:legal_aid_application) }
let(:lead_application) { create(:legal_aid_applicat... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/helpers/cookie_banner_helper_spec.rb | Ruby | mit | 19 | main | 1,467 | require "rails_helper"
RSpec.describe CookieBannerHelper do
let(:legal_aid_application) { create(:legal_aid_application, :with_applicant) }
let(:provider) { legal_aid_application.provider }
describe "#display_cookie_banner?" do
subject(:display_cookie_banner) { display_cookie_banner?(provider) }
contex... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/form_builders/form_builder_extensions/field_helpers_spec.rb | Ruby | mit | 19 | main | 2,018 | require "rails_helper"
RSpec.describe FormBuilderExtensions::FieldHelpers do
let(:builder) { ActionView::Base.default_form_builder.new(dummy_model.model_name, model_instance, view_context, {}) }
let(:view_context) { ActionView::Base.new(ActionController::Base.view_paths, {}, nil) }
let(:model_instance) { dummy_... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/validators/document_category_validator_spec.rb | Ruby | mit | 19 | main | 2,617 | require "rails_helper"
class DummyDocumentCategory
include ActiveModel::Model
include ActiveModel::Validations
validates_with DocumentCategoryValidator
end
RSpec.describe DocumentCategoryValidator do
describe "VALID_DOCUMENT_TYPE length" do
it "has 30 characters or fewer to be valid" do
doc_types =... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/validators/numericality_partner_optional_validator_spec.rb | Ruby | mit | 19 | main | 3,078 | require "rails_helper"
class DummyNumericalityClass
include ActiveModel::Model
include ActiveModel::Validations
attr_accessor :val1, :val2, :val3, :val4, :val5
validates :val1, :val2, numericality_partner_optional: { greater_than_or_equal_to: 0 }, allow_blank: true
validates :val3, numericality_partner_opt... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/validators/currency_validator_spec.rb | Ruby | mit | 19 | main | 3,661 | require "rails_helper"
class DummyCurrencyClass
include ActiveModel::Model
include ActiveModel::Validations
attr_accessor :val1, :val2, :val3, :val4, :val5
validates :val1, :val2, currency: { greater_than_or_equal_to: 0 }, allow_blank: true
validates :val3, currency: { greater_than_or_equal_to: 0 }
valid... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/validators/presence_partner_optional_validator_spec.rb | Ruby | mit | 19 | main | 1,624 | require "rails_helper"
class DummyPartnerPresenceClass
include ActiveModel::Model
include ActiveModel::Validations
attr_accessor :val1, :val2, :val3
validates :val1, presence: true
validates :val2, presence_partner_optional: { partner_labels: :partner_check_true? }
validates :val3, presence_partner_optio... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/flow_helpers.rb | Ruby | mit | 19 | main | 823 | module FlowHelpers
# Takes the last request path and uses it to determine the next step from flows
def flow_forward_path
path_details = Rails.application.routes.recognize_path(request.path, method: request.method)
controller_details = path_details[:controller].split("/")
controller_module = controller_d... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/sidekiq_setup.rb | Ruby | mit | 19 | main | 283 | require "rspec-sidekiq"
require "sidekiq/testing"
RSpec::Sidekiq.configure do |config|
config.clear_all_enqueued_jobs = true # default => true
config.enable_terminal_colours = true # default => true
config.warn_when_jobs_not_processed_by_sidekiq = false # default => true
end |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/xml_entity_matcher.rb | Ruby | mit | 19 | main | 414 | module XMLEntitykMatchers
RSpec::Matchers.define :have_means_entity do |expected|
match do |actual_xml|
doc = Nokogiri::XML(actual_xml).remove_namespaces!
entity_block = doc.xpath %(//MeansAssesments//AssesmentDetails//Entity[EntityName = "#{expected}"])
expect(entity_block).not_to be_empty
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/summary_list_row.rb | Ruby | mit | 19 | main | 449 | class SummaryListRow
def initialize(key, value)
@key = key
@value = value
end
def matches?(page)
@summary_list = page.find("dl.govuk-summary-list")
summary_list_key = @summary_list.find("dt", text: @key)
summary_list_key.sibling("dd").text == @value
end
def failure_message
"Expected ... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/task_list_matcher.rb | Ruby | mit | 19 | main | 1,403 | RSpec::Matchers.define :have_completed_task do |group, task_name|
description { "have task in a \"completed\" state" }
match do |actual|
expect(actual).to have_task_in_state(group, task_name, :complete)
end
end
RSpec::Matchers.define :have_not_started_task do |group, task_name|
description { "have task in... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/pundit_matcher.rb | Ruby | mit | 19 | main | 398 | RSpec::Matchers.define :permit do |action|
match do |policy|
policy.public_send(:"#{action}?")
end
failure_message_when_negated do |policy|
"#{policy.class} does not permit #{action} on #{policy.record} for #{policy.provider.inspect}."
end
failure_message do |policy|
"#{policy.class} does not fo... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/request_error_helpers.rb | Ruby | mit | 19 | main | 471 | # Use to have specs handle errors as they would be on production
#
RSpec.configure do |config|
config.before(:each, :show_exceptions) do
method = Rails.application.method(:env_config)
allow(Rails.application).to receive(:env_config).with(no_args) do
method.call.merge(
"action_dispatch.show_exce... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/change_link_matcher.rb | Ruby | mit | 19 | main | 900 | CHANGE_LINKS_CONTAINING_UUIDS = %i[success_likely].freeze
RSpec::Matchers.define :have_change_link do |field_name, expected_link|
match do |actual|
@uuid = expected_link.match(/(?<=merits_task_list\/)(.*)(?=\/)/).to_s
link = extract_link(actual, formatted_field_name(field_name))
link == expected_link
e... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/back_link_matcher.rb | Ruby | mit | 19 | main | 1,002 | RSpec::Matchers.define :have_back_link do |expected|
match do |actual|
back_link = extract_back_link(actual)
matching_urls?(back_link, expected)
end
failure_message do |actual|
back_link = extract_back_link(actual)
if back_link.nil?
"Expected to find back link, but none found"
else
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/xml_attribute_block_matcher.rb | Ruby | mit | 19 | main | 5,150 | # These matchers are used for testing the contents of an XML attribute
# block in the payload.
#
# 'actual' is expected to be an instance of Nokogiri::XML::NodeSet, which
# is obtained by calling #xpath on an instance of Nokogiri::XML::Document,
# or more simply, by calling XmlExtractor on an XML string
#
module XMLBl... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/file_helpers.rb | Ruby | mit | 19 | main | 386 | def ccms_data_from_file(filename)
path = Rails.root.join "spec/data/ccms", filename
File.read path
end
def squish_xml(xml)
xml.gsub(/\n\s+/, "\n ")
end
def remove_xml_header(xml)
xml.gsub("<?xml version='1.0' encoding='UTF-8'?>\n", "")
end
def extract_url_from(wsdl)
File.open(wsdl) do |f|
Nokogiri::XML... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/common_methods.rb | Ruby | mit | 19 | main | 461 | def parsed_response_body(html = response.body)
Nokogiri::HTML(html)
end
def button_value(html_body:, attr:)
parsed_response_body(html_body).css(attr)[0].attr(:value)
end
def save_xml_in_temp_file(_xml)
filename = Rails.root.join("tmp/generated_add_case_request.xml")
File.open(filename, "w") do |fp|
fp.put... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/soap_matchers.rb | Ruby | mit | 19 | main | 1,467 | # use as follows:
#
# expect(history.request).to be_soap_envelope_with(
# command: 'ns2:ReferenceDataInqRQ',
# transaction_id: '20190301030405123456',
# matching: ['<ns5:ContextKey>CaseReferenceNumber</ns5:Con... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/webmock_setup.rb | Ruby | mit | 19 | main | 561 | require "webmock/rspec"
allowed_sites = [
lambda do |uri|
[
/__identify__/,
/127.0.0.1.*(session|shutdown|status)/,
/chromedriver\.storage\.googleapis\.com/,
].any? { |pattern| uri.to_s =~ pattern }
end,
]
# NOTE: net_http_connect_on_start is required to have capybara and webmock play ni... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/load_ccms_attribute_array.rb | Ruby | mit | 19 | main | 321 | def load_ccms_attribute_array(path)
CSV.readlines(Rails.root.join("spec/fixtures/files/ccms_attributes", path)).each_with_object([]) do |line, output|
key = line[0].parameterize.to_sym
output << if line[1].nil?
[key]
else
[key, line[1]]
end
end
end |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/true_layer_helpers.rb | Ruby | mit | 19 | main | 1,843 | module TrueLayerHelpers
def stub_true_layer
stub_true_layer_provider
stub_true_layer_accounts
stub_true_layer_account_holders
stub_true_layer_account_balances
stub_true_layer_transactions
end
def stub_true_layer_provider
result = MOCK_DATA[:provider]
stub_true_layer_endpoint("/data/v1... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/xml_extractor.rb | Ruby | mit | 19 | main | 7,960 | class XmlExtractor
XPATHS = {
additional_property: %(//MeansAssesments//AssesmentDetails//Entity[EntityName = "ADDPROPERTY"]//Attributes/Attribute),
bank_accounts_entity: %(/Envelope/Body/CaseAddRQ/Case/CaseDetails/ApplicationDetails/MeansAssesments/AssesmentResults/AssesmentDetails/AssessmentScreens/Entity[E... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/view_component.rb | Ruby | mit | 19 | main | 217 | require "view_component/test_helpers"
require "capybara/rspec"
RSpec.configure do |config|
config.include ViewComponent::TestHelpers, type: :component
config.include Capybara::RSpecMatchers, type: :component
end |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/vcr_setup.rb | Ruby | mit | 19 | main | 1,846 | require "vcr"
vcr_debug = ENV["VCR_DEBUG"].to_s == "true"
record_mode = ENV["VCR_RECORD_MODE"] ? ENV["VCR_RECORD_MODE"].to_sym : :once
VCR.configure do |vcr_config|
vcr_config.cassette_library_dir = "spec/cassettes"
vcr_config.hook_into :webmock
vcr_config.default_cassette_options = {
record: record_mode,
... |
github | ministryofjustice/laa-apply-for-legal-aid | https://github.com/ministryofjustice/laa-apply-for-legal-aid | spec/support/true_layer_mock_data.rb | Ruby | mit | 19 | main | 2,371 | module TrueLayerHelpers
MOCK_DATA = {
provider: {
credentials_id: SecureRandom.hex,
provider: {
display_name: "Lloyds Bank",
provider_id: "lloyds",
},
},
account_holders: [
{
full_name: Faker::Name.name,
date_of_birth: Faker::Date.backward.to_time.ut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.