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/factories/dwp_overrides.rb
Ruby
mit
19
main
324
FactoryBot.define do factory :dwp_override do legal_aid_application passporting_benefit { "universal_credit" } has_evidence_of_benefit { nil } trait :with_no_evidence do has_evidence_of_benefit { false } end trait :with_evidence do has_evidence_of_benefit { true } end end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/document_categories.rb
Ruby
mit
19
main
365
FactoryBot.define do factory :document_category do name { "document_name" } submit_to_ccms { false } ccms_document_type { "document_type" } display_on_evidence_upload { false } mandatory { false } end trait :with_real_data do name { "bank_transaction_report" } submit_to_ccms { true } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/service_levels.rb
Ruby
mit
19
main
342
FactoryBot.define do factory :service_level do service_level_number { Faker::Number.number(digits: 2) } name { Faker::Lorem.sentence } trait :with_real_data do service_level_number { 3 } name { "Full Representation" } end initialize_with { ServiceLevel.find_or_create_by(service_level...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/addresses.rb
Ruby
mit
19
main
669
FactoryBot.define do factory :address do applicant address_line_one { Faker::Address.building_number } address_line_two { Faker::Address.street_address } city { Faker::Address.city } county { Faker::Address.city } country_code { "GBR" } country_name { "United Kingdom" } postcode { ["SW...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/uploaded_evidence_collections.rb
Ruby
mit
19
main
4,969
FactoryBot.define do factory :uploaded_evidence_collection, class: "UploadedEvidenceCollection" do legal_aid_application trait :with_original_file_attached do after :create do |ge| attachment = ge.legal_aid_application.attachments.create!(attachment_type: "gateway_evidence", ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/allegations.rb
Ruby
mit
19
main
271
FactoryBot.define do factory :allegation, class: "ApplicationMeritsTask::Allegation" do denies_all { true } legal_aid_application trait :with_data do denies_all { false } additional_information { "extenuating circumstances" } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/ccms_submission_histories.rb
Ruby
mit
19
main
2,201
FactoryBot.define do factory :ccms_submission_history, class: "CCMS::SubmissionHistory" do submission from_state { "initialised" } to_state { "case_ref_obtained" } success { Faker::Boolean.boolean } details { Faker::Lorem.word } request { Faker::Lorem.word } response { Faker::Lorem.word }...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/incidents.rb
Ruby
mit
19
main
326
FactoryBot.define do factory :incident, class: "ApplicationMeritsTask::Incident" do told_on { Faker::Date.backward(days: 90) } occurred_on { Faker::Date.backward(days: 90) - 1.year } first_contact_date { Faker::Date.backward(days: 90) } details { Faker::Lorem.paragraph } legal_aid_application en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/schedules.rb
Ruby
mit
19
main
477
FactoryBot.define do factory :schedule do office_id { Faker::Number.unique.number(digits: 10).to_s } area_of_law { "LEGAL HELP" } category_of_law { "MAT" } authorisation_status { "APPROVED" } status { "Open" } cancelled { false } office end trait :valid do start_date { Date.curren...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/ccms_submission_documents.rb
Ruby
mit
19
main
281
FactoryBot.define do factory :ccms_submission_document, class: "CCMS::SubmissionDocument" do submission attachment_id { SecureRandom.uuid } status { "uploaded" } document_type { "means_report" } ccms_document_id { Faker::Number.number(digits: 8) } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/proceedings.rb
Ruby
mit
19
main
24,401
FactoryBot.define do factory :proceeding do legal_aid_application substantive_level_of_service { "3" } substantive_level_of_service_name { "Full Representation" } substantive_level_of_service_stage { "8" } emergency_level_of_service { "3" } emergency_level_of_service_name { "Full Representatio...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/transaction_types.rb
Ruby
mit
19
main
2,854
# (0..10).map {|n| repeating_sequence(n, 3)} gives: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1] def repeating_sequence(current, length) current - (length * (current / length)) end # using repeating_sequence here so that index is always within the range of existing names def repeating_sequence_for_transaction_type(type, curren...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/statement_of_cases.rb
Ruby
mit
19
main
1,822
FactoryBot.define do factory :statement_of_case, class: "ApplicationMeritsTask::StatementOfCase" do legal_aid_application statement { Faker::Lorem.paragraph } trait :with_empty_text do statement { nil } end trait :with_original_file_attached do statement { "Statement of case text en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/partners.rb
Ruby
mit
19
main
1,505
FactoryBot.define do factory :partner do first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } date_of_birth { Faker::Date.birthday } has_national_insurance_number { true } national_insurance_number { "JA123456D" } shared_benefit_with_applicant { false } legal_aid_appli...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/submission_documents.rb
Ruby
mit
19
main
737
FactoryBot.define do factory :submission_document, class: "CCMS::SubmissionDocument" do submission attachment_id { SecureRandom.uuid } trait :new do status { :new } document_type { :statement_of_case } ccms_document_id { nil } end trait :id_obtained do status { :id_obtain...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/undertakings.rb
Ruby
mit
19
main
267
FactoryBot.define do factory :undertaking, class: "ApplicationMeritsTask::Undertaking" do offered { true } legal_aid_application trait :with_data do offered { false } additional_information { "extenuating circumstances" } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/applicants.rb
Ruby
mit
19
main
4,059
FactoryBot.define do factory :applicant do first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } date_of_birth { Faker::Date.birthday } email { Faker::Internet.email } has_national_insurance_number { true } national_insurance_number { "JA123456D" } employed { false } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/offices.rb
Ruby
mit
19
main
270
FactoryBot.define do factory :office do ccms_id { Faker::Number.unique.number(digits: 10).to_s } code { Faker::Number.unique.number(digits: 10).to_s } firm end trait :with_valid_schedule do schedules { build_list(:schedule, 1, :valid) } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/scheduled_mailings.rb
Ruby
mit
19
main
2,348
FactoryBot.define do factory :scheduled_mailing do legal_aid_application mailer_klass { "SubmitApplicationReminderMailer" } mailer_method { "notify_provider" } status { "processing" } addressee { Faker::Internet.email } arguments { [legal_aid_application.id, "Bob Marley", "bob@wailing.jm"] } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/parties_mental_capacities.rb
Ruby
mit
19
main
271
FactoryBot.define do factory :parties_mental_capacity, class: "ApplicationMeritsTask::PartiesMentalCapacity" do legal_aid_application understands_terms_of_court_order { "false" } understands_terms_of_court_order_details { Faker::Lorem.paragraph } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/bank_transactions.rb
Ruby
mit
19
main
3,314
FactoryBot.define do factory :bank_transaction do bank_account true_layer_id { SecureRandom.hex } description { Faker::Lorem.sentence } merchant { Faker::Lorem.sentence } happened_at { Faker::Date.between(from: 3.months.ago + 2.days, to: 2.days.ago) } currency { Faker::Currency.code } amou...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/employment_payments.rb
Ruby
mit
19
main
428
FactoryBot.define do factory :employment_payment do employment sequence(:date) { |n| n.months.ago } gross { Faker::Number.within(range: 1000.01..2900.99).round(2) } benefits_in_kind { 0.0 } tax { Faker::Number.within(range: -842.01..-25.99).round(2) } national_insurance { Faker::Number.within(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/firms.rb
Ruby
mit
19
main
332
FactoryBot.define do factory :firm do ccms_id { rand(1..1000) } name { Faker::Company.name } end trait :with_no_permissions do permissions { [] } end trait :with_dummy_permission do permissions do dummy_permission = create(:permission, :dummy_permission) [dummy_permission] en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/providers.rb
Ruby
mit
19
main
1,576
FactoryBot.define do factory :provider do silas_id { SecureRandom.uuid } firm name { Faker::Name.name } username { "#{Faker::Internet.username}_#{Random.rand(1...999).to_s.rjust(3, '0')}" } ccms_contact_id { 111_111_111 } email { Faker::Internet.email } auth_provider { "entra_id" } tra...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/opponents.rb
Ruby
mit
19
main
1,854
FactoryBot.define do factory :opponent, class: "ApplicationMeritsTask::Opponent" do legal_aid_application for_individual transient do first_name { nil } last_name { nil } organisation_name { nil } organisation_ccms_type_code { nil } organisation_ccms_type_text { nil } en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/default_cost_limtiations.rb
Ruby
mit
19
main
522
FactoryBot.define do factory :default_cost_limitation do proceeding_type trait :substantive do cost_type { "substantive" } start_date { Date.parse("1970-01-01") } value { 25_000.0 } end trait :original_df do cost_type { "delegated_functions" } start_date { Date.parse("1...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/domestic_abuse_summaries.rb
Ruby
mit
19
main
733
FactoryBot.define do factory :domestic_abuse_summary, class: "ApplicationMeritsTask::DomesticAbuseSummary" do legal_aid_application warning_letter_sent { "false" } warning_letter_sent_details { Faker::Lorem.paragraph } police_notified { %w[true false].sample } police_notified_details { Faker::Lore...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/employments.rb
Ruby
mit
19
main
5,185
FactoryBot.define do factory :employment do legal_aid_application sequence(:name) { |n| sprintf("Job %05d", n) } trait :example1_usecase1 do name { "Job 788" } after(:create) do |employment| create(:employment_payment, employment:, date: Date.new(2021, 1...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/linked_applications.rb
Ruby
mit
19
main
221
FactoryBot.define do factory :linked_application, class: "LinkedApplication" do lead_application { nil } associated_application { nil } trait :family do link_type_code { "FC_LEAD" } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/savings_amounts.rb
Ruby
mit
19
main
2,046
FactoryBot.define do factory :savings_amount do legal_aid_application trait :with_values do offline_current_accounts do [true, false].sample ? rand(1...1_000_000.0).round(2) : -rand(1...1_000_000.0).round(2) end offline_savings_accounts do [true, false].sample ? rand(1...1_0...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/feedbacks.rb
Ruby
mit
19
main
1,021
FactoryBot.define do factory :feedback do done_all_needed { Faker::Boolean.boolean } done_all_needed_reason { nil } satisfaction { Feedback.satisfactions.keys.sample } satisfaction_reason { Faker::Lorem.paragraph } difficulty { Feedback.difficulties.keys.sample } difficulty_reason { Faker::Lor...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/legal_framework_serializable_merits_task.rb
Ruby
mit
19
main
264
FactoryBot.define do factory :legal_framework_serializable_merits_task, class: "LegalFramework::SerializableMeritsTask" do initialize_with { new(name, dependencies:) } dependencies { [:application_children] } name { :proceeding_children } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/legal_framework_merits_task_list.rb
Ruby
mit
19
main
3,208
FactoryBot.define do factory :legal_framework_merits_task_list, class: "LegalFramework::MeritsTaskList" do legal_aid_application serialized_data { build(:legal_framework_serializable_merits_task_list).to_yaml } trait :da001 do serialized_data { build(:legal_framework_serializable_merits_task_list, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/chances_of_successes.rb
Ruby
mit
19
main
457
FactoryBot.define do factory :chances_of_success, class: "ProceedingMeritsTask::ChancesOfSuccess" do trait :with_optional_text do application_purpose { Faker::Lorem.paragraph } success_prospect { "marginal" } success_prospect_details { Faker::Lorem.paragraph } end trait :without_optiona...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/true_layer_banks.rb
Ruby
mit
19
main
514
FactoryBot.define do factory :true_layer_bank do banks do [ { provider_id: "ob-bos", display_name: "Bank of Scotland", logo_url: "https://truelayer-client-logos.s3-eu-west-1.amazonaws.com/banks/banks-icons/ob-bos-icon.svg", }, { provider_id: "o...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results.rb
Ruby
mit
19
main
2,742
FactoryBot.define do factory :cfe_v1_result, class: "CFE::V1::Result" do submission factory: :cfe_submission legal_aid_application { submission.legal_aid_application } result { CFEResults::V1::MockResults.eligible.to_json } trait :eligible do result { CFEResults::V1::MockResults.eligible.to_jso...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/dependants.rb
Ruby
mit
19
main
1,111
FactoryBot.define do factory :dependant do legal_aid_application number { Faker::Number.number(digits: 2) } name { Faker::Name.name } date_of_birth { Faker::Date.birthday(min_age: 7, max_age: 77) } relationship { Dependant.relationships.keys.sample } monthly_income { rand(1...10_000.0).round(2...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/bank_accounts.rb
Ruby
mit
19
main
382
FactoryBot.define do factory :bank_account do bank_provider true_layer_id { SecureRandom.hex } name { Faker::Bank.name } currency { Faker::Currency.code } account_number { Faker::Number.number } sort_code { Faker::Number.number(digits: 6) } balance { BigDecimal(rand(1...1_000_000.0), 2) } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/hmrc/responses.rb
Ruby
mit
19
main
1,669
require Rails.root.join("spec/factory_helpers/hmrc_response/use_case_one.rb") module HMRC FactoryBot.define do factory :hmrc_response, class: "HMRC::Response" do legal_aid_application submission_id { SecureRandom.uuid } use_case { "one" } trait :with_legal_aid_applicant do legal_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/proceeding_merits_task/proceeding_linked_children.rb
Ruby
mit
19
main
201
module ProceedingMeritsTask FactoryBot.define do factory :proceeding_linked_child, class: "ProceedingMeritsTask::ProceedingLinkedChild" do involved_child proceeding end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/proceeding_merits_task/opponents_application.rb
Ruby
mit
19
main
330
FactoryBot.define do factory :opponents_application, class: "ProceedingMeritsTask::OpponentsApplication" do has_opponents_application { true } proceeding trait :with_data do has_opponents_application { false } reason_for_applying { "additional information about reason for applying" } end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/proceeding_merits_task/child_care_assessments.rb
Ruby
mit
19
main
418
FactoryBot.define do factory :child_care_assessment, class: "ProceedingMeritsTask::ChildCareAssessment" do proceeding assessed { false } trait :negative_assessment do assessed { true } result { false } details { Faker::Lorem.paragraph(sentence_count: 2) } end trait :positive_as...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/application_merits_task/matter_oppositions.rb
Ruby
mit
19
main
232
module ApplicationMeritsTask FactoryBot.define do factory :matter_opposition, class: "ApplicationMeritsTask::MatterOpposition" do legal_aid_application reason { "A reason to oppose the matter." } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/application_merits_task/involved_children.rb
Ruby
mit
19
main
352
module ApplicationMeritsTask FactoryBot.define do factory :involved_child, class: "ApplicationMeritsTask::InvolvedChild" do legal_aid_application first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } date_of_birth { Faker::Date.between(from: Date.new(2000, 1, 1), to: Da...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/application_merits_task/appeals.rb
Ruby
mit
19
main
252
module ApplicationMeritsTask FactoryBot.define do factory :appeal, class: "ApplicationMeritsTask::Appeal" do legal_aid_application second_appeal { false } original_judge_level { nil } court_type { nil } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/citizen/access_tokens.rb
Ruby
mit
19
main
224
module Citizen FactoryBot.define do factory :citizen_access_token, class: "Citizen::AccessToken" do legal_aid_application token { SecureRandom.uuid } expires_on { 8.days.from_now } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/state_benefit_types/mock_state_benefit_type_result.rb
Ruby
mit
19
main
17,924
module CFE class MockStateBenefitTypeResult def self.full_list [ { "label" => "age_related_payment", "name" => "Age Related Payment", "exclude_from_gross_income" => false, "dwp_code" => "ARP", "category" => nil, }, { "label"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v6/results.rb
Ruby
mit
19
main
5,121
module CFEResults module V6 FactoryBot.define do factory :cfe_v6_result, class: "CFE::V6::Result" do submission factory: :cfe_submission legal_aid_application { submission.legal_aid_application } result { CFEResults::V6::MockResults.eligible.to_json } type { "CFE::V6::Result"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v6/mock_results.rb
Ruby
mit
19
main
43,136
module CFEResults module V6 class MockResults def self.eligible { version: "6", timestamp: "2021-05-26T12:51:56.329Z", success: true, result_summary: { overall_result: { result: "eligible", capital_contribution: 0.0, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v1/mock_results.rb
Ruby
mit
19
main
3,102
module CFEResults module V1 class MockResults def self.eligible { assessment_result: "eligible", applicant: { receives_qualifying_benefit: true, age_at_submission: 39, }, capital: { total_liquid: "350.0", total_n...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v5/mock_results.rb
Ruby
mit
19
main
19,776
module CFEResults module V5 class MockResults def self.eligible { version: "5", timestamp: "2021-05-26T12:51:56.329Z", success: true, result_summary: { overall_result: { result: "eligible", capital_contribution: 0.0, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v5/results.rb
Ruby
mit
19
main
4,003
module CFEResults module V5 FactoryBot.define do factory :cfe_v5_result, class: "CFE::V5::Result" do submission factory: :cfe_submission legal_aid_application { submission.legal_aid_application } result { CFEResults::V5::MockResults.eligible.to_json } type { "CFE::V5::Result"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v2/mock_results.rb
Ruby
mit
19
main
12,249
module CFEResults module V2 class MockResults def self.eligible { version: "2", timestamp: "2020-01-28T16:37:07.921+00:00", success: true, assessment: { id: "41188692-9fa1-488d-818f-67f8509ff21a", client_reference_id: "CLIENT-REF-0007",...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/empty/mock_results.rb
Ruby
mit
19
main
6,931
module CFEResults module Empty class MockResults def self.no_assessment { version: "Empty", timestamp: "2022-07-21T02:39:58+01:00", success: true, result_summary: { overall_result: { result: "no_assessment", capital_cont...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/empty/results.rb
Ruby
mit
19
main
371
module CFEResults module Empty FactoryBot.define do factory :cfe_empty_result, class: "CFE::Empty::Result" do submission factory: :cfe_submission legal_aid_application { submission.legal_aid_application } result { CFEResults::Empty::MockResults.no_assessment.to_json } type { ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v3/results.rb
Ruby
mit
19
main
2,107
module CFEResults module V3 FactoryBot.define do factory :cfe_v3_result, class: "CFE::V3::Result" do submission factory: :cfe_submission legal_aid_application { submission.legal_aid_application } result { CFEResults::V3::MockResults.eligible.to_json } type { "CFE::V3::Result"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v3/mock_results.rb
Ruby
mit
19
main
11,193
module CFEResults module V3 class MockResults def self.eligible { version: "3", timestamp: "2020-01-28T16:37:07.921+00:00", success: true, assessment: { id: "41188692-9fa1-488d-818f-67f8509ff21a", client_reference_id: "CLIENT-REF-0007",...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v4/mock_results.rb
Ruby
mit
19
main
19,776
module CFEResults module V4 class MockResults def self.eligible { version: "4", timestamp: "2021-05-26T12:51:56.329Z", success: true, result_summary: { overall_result: { result: "eligible", capital_contribution: 0.0, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cfe_results/v4/results.rb
Ruby
mit
19
main
4,003
module CFEResults module V4 FactoryBot.define do factory :cfe_v4_result, class: "CFE::V4::Result" do submission factory: :cfe_submission legal_aid_application { submission.legal_aid_application } result { CFEResults::V4::MockResults.eligible.to_json } type { "CFE::V4::Result"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/submit_citizen_reminder_service_spec.rb
Ruby
mit
19
main
1,405
require "rails_helper" RSpec.describe SubmitCitizenReminderService do include Rails.application.routes.url_helpers let(:legal_aid_application) { create(:legal_aid_application, applicant:) } let(:applicant) do build( :applicant, first_name: "Test", last_name: "User", email: "test@exa...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/delegated_functions_date_service_spec.rb
Ruby
mit
19
main
4,334
require "rails_helper" RSpec.describe DelegatedFunctionsDateService do describe "sets date on proceeding records" do subject(:call) { described_class.call(laa) } let(:laa) { create(:legal_aid_application) } let(:df_used?) { true } let(:df_date) { Date.new(2021, 5, 10) } let(:reported_date) { Dat...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/mark_purgeable_service_spec.rb
Ruby
mit
19
main
845
require "rails_helper" RSpec.describe MarkPurgeableService do describe ".call" do let(:old_date1) { 24.months.ago } let(:old_date2) { 23.months.ago - 1.day } let!(:old1) { create(:legal_aid_application, updated_at: old_date1) } let!(:old2) { create(:legal_aid_application, updated_at: old_date2) } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/malware_scanner_spec.rb
Ruby
mit
19
main
3,275
require "rails_helper" RSpec.describe MalwareScanner do subject(:malware_scanner) do described_class.call( file_path:, uploader: provider, file_details:, ) end let(:provider) { create(:provider) } let(:file_path) { Rails.root.join("spec/fixtures/files/documents/hello_world.pdf") } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/submit_application_reminder_service_spec.rb
Ruby
mit
19
main
2,189
require "rails_helper" require "sidekiq/testing" RSpec.describe SubmitApplicationReminderService, :vcr do subject(:submit_application_reminder_service) { described_class.new(application) } let(:provider) { create(:provider, email: "test@example.com") } let(:application) do create(:application, :w...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/page_history_service_spec.rb
Ruby
mit
19
main
931
require "rails_helper" RSpec.describe PageHistoryService do subject(:page_history_service) { described_class.new(page_history_id:) } let!(:redis) { Redis.new(url: Rails.configuration.x.redis.page_history_url) } let(:page_history_id) { SecureRandom.uuid } let(:key) { "page_history:#{page_history_id}" } let(:...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/currency_cleaner_spec.rb
Ruby
mit
19
main
1,075
require "rails_helper" RSpec.describe CurrencyCleaner do context "when there are valid strings" do it "returns the string stripped of commas and pound signs" do valid_strings = [ %w[£1,123,456.78 1123456.78], %w[£1,123,456 1123456], %w[£1,123.45 1123.45], %w[£123456.78 12345...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/pdf_attachment_creator_spec.rb
Ruby
mit
19
main
8,203
require "rails_helper" FileStruct = Struct.new(:name, :content_type) RSpec.describe PDFAttachmentCreator do subject(:call) do described_class.call(attachment.id) end before { allow(PDF::ConvertFile).to receive(:call).and_return(temp_file) } let(:temp_file) { File.open(filepath) } context "when attach...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/reference_number_spec.rb
Ruby
mit
19
main
697
require "rails_helper" RSpec.describe ReferenceNumber do describe ".generate" do before do seed_random_generator stub_existing_reference_number(anything, nil) end it "generates unique numbers" do expect(described_class.generate).to eq("L-FL6-NCM") stub_existing_reference_number(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/provider_email_service_spec.rb
Ruby
mit
19
main
1,213
require "rails_helper" require "sidekiq/testing" RSpec.describe ProviderEmailService do subject(:provider_email_service) { described_class.new(application) } let(:applicant) { create(:applicant, first_name: "John", last_name: "Doe") } let(:provider) { create(:provider, email: "test@example.com") } let(:applic...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/mock_benefit_check_service_spec.rb
Ruby
mit
19
main
1,237
require "rails_helper" RSpec.describe MockBenefitCheckService do subject(:mock_benefit_check) { described_class.call(application) } let(:last_name) { "Smith" } let(:date_of_birth) { "1999/01/11".to_date } let(:national_insurance_number) { "ZZ123459A" } let(:applicant) { create(:applicant, last_name:, date_o...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/submit_provider_reminder_service_spec.rb
Ruby
mit
19
main
910
require "rails_helper" require "sidekiq/testing" RSpec.describe SubmitProviderReminderService, :vcr do let(:provider) { create(:provider, email: "test@example.com") } let(:application) { create(:application, :with_applicant, provider:) } let(:application_url) { "http://test.com" } describe "#send_email" do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/digest_extractor_spec.rb
Ruby
mit
19
main
1,193
require "rails_helper" RSpec.describe DigestExtractor do describe ".call" do let!(:application_five_day_old) { create(:legal_aid_application, :with_applicant, :with_cfe_v3_result, updated_at: 5.days.ago) } let!(:application_three_day_old) { create(:legal_aid_application, :with_applicant, :with_cfe_v3_result,...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/age_calculator_spec.rb
Ruby
mit
19
main
1,285
require "rails_helper" RSpec.describe AgeCalculator do subject { described_class.call(date_of_birth, date) } let(:date_of_birth) { Date.parse("15-08-2000") } context "when date is 1 day after birthday" do let(:date) { Date.parse("16-08-2010") } it { is_expected.to eq(10) } end context "when date ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/document_category_analyser_spec.rb
Ruby
mit
19
main
8,517
require "rails_helper" RSpec.describe DocumentCategoryAnalyser do before { DocumentCategoryPopulator.call } describe "#call" do subject(:call) { described_class.call(application) } context "when the application has dwp result overriden" do let(:dwp_override) { create(:dwp_override, :with_evidence) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/oauth_session_saver_spec.rb
Ruby
mit
19
main
1,754
require "rails_helper" RSpec.describe OauthSessionSaver do let(:session) do { "session_id" => "c38047b5f6a12c9de1540621ac8dc7d3", "current_application_id" => "583496de-f14e-46b5-bbff-8f95b4d6af22", "page_history_id" => "c121c57a-2802-4793-b700-af30b212d63b", "warden.user.applicant.key" =>...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/secure_application_finder_spec.rb
Ruby
mit
19
main
2,224
require "rails_helper" RSpec.describe SecureApplicationFinder do let(:legal_aid_application) { build(:legal_aid_application) } let(:citizen_access_token) do create( :citizen_access_token, legal_aid_application:, expires_on: Time.zone.today + 2.years, ) end before { travel_to today } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/working_day_calculator_spec.rb
Ruby
mit
19
main
3,034
require "rails_helper" RSpec.describe WorkingDayCalculator do let(:day) { Date.parse("16-Dec-2025") } let(:working_day) { described_class.new(day) } let(:three_working_days_later) { Date.parse("19-Dec-2025") } # No skip let(:four_working_days_later) { Date.parse("22-Dec-2025") } # Weekend skip let(:seven_wo...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/citizen_email_service_spec.rb
Ruby
mit
19
main
1,241
require "rails_helper" RSpec.describe CitizenEmailService do include Rails.application.routes.url_helpers let(:legal_aid_application) do create( :legal_aid_application, applicant:, provider: build(:provider, firm: build(:firm, name: "Test Firm")), ) end let(:applicant) do build(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/enable_ccms_submission_spec.rb
Ruby
mit
19
main
964
require "rails_helper" RSpec.describe EnableCCMSSubmission do subject(:enable_ccms_submission) { described_class.call } before do allow(Rails.configuration.x.ccms_soa).to receive(:submit_applications_to_ccms).and_return(allow_ccms_submission_var) allow(Setting).to receive(:enable_ccms_submission?).and_ret...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/benefit_check_service_spec.rb
Ruby
mit
19
main
6,801
require "rails_helper" RSpec.describe BenefitCheckService do subject(:benefit_check_service) { described_class.new(application) } before do allow(Rails.configuration.x.benefit_check).to receive_messages(service_name: Rails.configuration.x.benefit_check.wsdl_url, client_org_id: "dummy_client_org_id", client_us...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/document_category_populator_spec.rb
Ruby
mit
19
main
1,116
require "rails_helper" require "csv" RSpec.describe DocumentCategoryPopulator do describe "#call" do let(:seed_file) { Rails.root.join("db/seeds/document_categories.csv") } it "create instances from the seed file" do expect { described_class.call }.to change(DocumentCategory, :count).by(seed_file.read...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/bank_holiday_retriever_spec.rb
Ruby
mit
19
main
2,320
require "rails_helper" RSpec.describe BankHolidayRetriever do subject(:instance) { described_class.new } let(:group) { "england-and-wales" } around do |example| VCR.turned_off { example.run } end before do stub_bankholiday_success end describe ".dates" do it "returns same as instance dates...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/substantive_application_deadline_calculator_spec.rb
Ruby
mit
19
main
893
require "rails_helper" RSpec.describe SubstantiveApplicationDeadlineCalculator do describe ".call" do subject(:call) { described_class.call(df_date) } let(:bank_holidays_cache) { Redis.new(url: Rails.configuration.x.redis.bank_holidays_url) } context "when passed the regular 4 weeks" do let(:df_d...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/bank_holiday_store_spec.rb
Ruby
mit
19
main
3,576
require "rails_helper" RSpec.describe BankHolidayStore do subject(:instance) { described_class.new } let(:redis) { Redis.new(url: Rails.configuration.x.redis.bank_holidays_url) } let(:redis_key) { "bank_holiday_dates" } let(:date_values) { %w[2025-12-25 2025-12-26] } before do redis.flushdb end # ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/results_panel_selector_spec.rb
Ruby
mit
19
main
6,503
require "rails_helper" RSpec.describe ResultsPanelSelector do let(:legal_aid_application) { create(:legal_aid_application, :with_applicant) } let(:applicant) { legal_aid_application.applicant } before { allow(legal_aid_application).to receive(:cfe_result).and_return(cfe_result) } describe ".call" do cont...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/true_layer_error_decoder_spec.rb
Ruby
mit
19
main
2,669
require "rails_helper" RSpec.describe TrueLayerErrorDecoder do subject(:true_layer_error_decoder) { described_class.new(error_details) } let(:error_details) { true_layer_error_details_array } let(:error_description) { "TrueLayer's detailed explanation of the error" } describe "#error_heading" do context ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/manual_review_detailer_spec.rb
Ruby
mit
19
main
4,455
require "rails_helper" RSpec.describe ManualReviewDetailer do let(:legal_aid_application) { create(:legal_aid_application, :with_applicant) } let(:applicant) { legal_aid_application.applicant } describe ".call" do context "when there are no restrictions, no policy disregards. no extra employment information...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/destroy_purgeable_service_spec.rb
Ruby
mit
19
main
1,500
require "rails_helper" RSpec.describe DestroyPurgeableService do let!(:nil_rec) { create(:legal_aid_application, purgeable_on: nil, updated_at: 731.days.ago) } let!(:tomorrow_rec) { create(:legal_aid_application, purgeable_on: Time.zone.tomorrow, updated_at: 731.days.ago) } let!(:yesterday_rec) { create(:legal_a...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/map_address_lookup_results_spec.rb
Ruby
mit
19
main
9,453
require "rails_helper" RSpec.describe MapAddressLookupResults do subject(:service) { described_class } describe "#call" do context "when the submission includes building number, street, town, city, postcode" do let(:result) do [{ "DPA" => { "ADDRESS" => "1, BIRKS, SLAITHWAITE, HUDDERSFI...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/address_lookup_service_spec.rb
Ruby
mit
19
main
3,478
require "rails_helper" RSpec.describe AddressLookupService do subject(:service) { described_class.new(postcode) } let(:query_params) do { key: ENV.fetch("ORDNANCE_SURVEY_API_KEY", nil), postcode:, lr: "EN", } end let(:api_request_uri) do uri = URI.parse(described_class::ORDNANCE_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/job_queue_spec.rb
Ruby
mit
19
main
1,627
require "rails_helper" require Rails.root.join("spec/mock_objects/mock_queued_job") RSpec.describe JobQueue do let(:long_delay) { EmailMonitorJob::DEFAULT_DELAY + 2.minutes } let(:short_delay) { EmailMonitorJob::DEFAULT_DELAY - 20.seconds } let(:late_job) { MockQueuedJob.new(EmailMonitorJob, long_delay.from_now)...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms_user/connection_spec.rb
Ruby
mit
19
main
419
require "rails_helper" RSpec.describe CCMSUser::Connection do subject(:connection) { described_class.new } it { is_expected.to respond_to :get } describe "#get" do subject(:get) { connection.get(uri) } let(:uri) { "/" } before { allow(connection.conn).to receive(:get) } it "delegated to adapt...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms_user/user_details_spec.rb
Ruby
mit
19
main
1,809
require "rails_helper" require Rails.root.join("spec/services/pda/provider_details_request_stubs") RSpec.describe CCMSUser::UserDetails do let(:provider) { create(:provider) } let(:uri) { "#{Rails.configuration.x.ccms_user_api.url}/user-details/silas/#{provider.silas_id}" } describe ".call" do subject(:call...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms/attribute_configuration_spec.rb
Ruby
mit
19
main
5,683
require "rails_helper" module CCMS RSpec.describe AttributeConfiguration, :ccms do before do allow_any_instance_of(described_class).to receive(:configuration_files).and_return(mock_configuration) end context "with standard application_type" do subject(:config) { described_class.new(applicati...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms/manual_review_determiner_spec.rb
Ruby
mit
19
main
18,595
require "rails_helper" module CCMS RSpec.describe ManualReviewDeterminer, :ccms do let(:determiner) { described_class.new(legal_aid_application) } let(:legal_aid_application) { create(:legal_aid_application, :with_applicant) } describe "#manual_review_required?" do subject(:manual_review_required)...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms/attribute_value_generator_spec.rb
Ruby
mit
19
main
2,831
require "rails_helper" module CCMS RSpec.describe AttributeValueGenerator, :ccms do let(:submission) { create(:submission) } let(:value_generator) { described_class.new(submission) } describe "#method_missing" do context "with a standardly_named_method" do describe "bank account" do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms/parsers/case_add_response_parser_spec.rb
Ruby
mit
19
main
1,999
require "rails_helper" module CCMS module Parsers RSpec.describe CaseAddResponseParser, :ccms do let(:expected_tx_id) { "20190301030405123456" } context "when the response is successful" do let(:response_xml) { ccms_data_from_file "case_add_response.xml" } describe "#success?" do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms/parsers/document_id_response_parser_spec.rb
Ruby
mit
19
main
1,661
require "rails_helper" module CCMS module Parsers RSpec.describe DocumentIdResponseParser, :ccms do let(:response_xml) { ccms_data_from_file "document_id_response.xml" } let(:expected_tx_id) { "20190301030405123456" } let(:expected_document_id) { "4420073" } context "when the response is...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms/parsers/applicant_add_response_parser_spec.rb
Ruby
mit
19
main
3,068
require "rails_helper" module CCMS module Parsers RSpec.describe ApplicantAddResponseParser, :ccms do let(:expected_tx_id) { "20190301030405123456" } context "when the response is successful" do describe "#success?" do let(:response_xml) { ccms_data_from_file "applicant_add_respons...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/services/ccms/parsers/document_upload_response_parser_spec.rb
Ruby
mit
19
main
470
require "rails_helper" module CCMS module Parsers RSpec.describe DocumentUploadResponseParser, :ccms do describe "#success?" do let(:response_xml) { ccms_data_from_file "document_upload_response.xml" } let(:expected_tx_id) { "20190301030405123456" } it "extracts the status" do ...