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/requests/v1/providers_spec.rb
Ruby
mit
19
main
1,771
require "rails_helper" RSpec.describe "PATCH /v1/providers" do let(:provider) { create(:provider, cookies_enabled: nil) } let(:id) { provider.id } let(:action) { "" } let(:params) { { provider: { action: } } } describe "PATCH /v1/legal_aid_applications/:id" do subject(:request) { patch v1_provider_path(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/requests/v1/workers_spec.rb
Ruby
mit
19
main
890
require "rails_helper" RSpec.describe "GET /v1/workers" do describe "GET /v1/workers/:worker_id" do subject(:get_request) { get v1_worker_path(id: worker_id) } let(:worker_id) { SecureRandom.hex } let(:worker_status) do { status: "complete", worker: "ImportBankDataWorker", ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/requests/v1/statement_of_cases_spec.rb
Ruby
mit
19
main
4,324
require "rails_helper" RSpec.describe "POST /v1/statement_of_case" do let(:legal_aid_application) { create(:legal_aid_application) } let(:id) { legal_aid_application.id } let(:file) { uploaded_file("spec/fixtures/files/documents/hello_world.pdf", "application/pdf") } let(:params) { { legal_aid_application_id: ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/requests/v1/attachments_spec.rb
Ruby
mit
19
main
1,398
require "rails_helper" RSpec.describe "v1/attachments" do let(:legal_aid_application) { create(:legal_aid_application) } let(:attachment) { create(:attachment, :uploaded_evidence_collection, legal_aid_application:) } describe "PATCH /v1/attachments/:id" do subject(:request) { patch v1_attachment_path(id), p...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/requests/v1/uploaded_evidence_collections_spec.rb
Ruby
mit
19
main
4,348
require "rails_helper" RSpec.describe "POST /v1/uploaded_evidence_collections" do let(:legal_aid_application) { create(:legal_aid_application) } let(:uploaded_evidence_collection) { legal_aid_application.uploaded_evidence_collection } let(:id) { legal_aid_application.id } let(:file) { uploaded_file("spec/fixtu...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/requests/v1/partners/bank_statements_spec.rb
Ruby
mit
19
main
6,004
require "rails_helper" # This tests the javascript enabled path for uploading bank statements # since this endpoint is called by dropzone. # # NOTE: empty files, over-large files, unacceptable format files # are handled by the javascript in dropzone.js and never reach this # endpoint so are not tested here. # RSpec.de...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/requests/test/generate_error_controller_spec.rb
Ruby
mit
19
main
499
require "rails_helper" RSpec.describe Test::GenerateErrorController do describe "GET trapped_error" do it "calls the Alert Manager" do expect(AlertManager).to receive(:capture_exception) get "/test/trapped_error" expect(response).to redirect_to root_path end end describe "untrapped err...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/requests/test/datastore_payloads_controller_spec.rb
Ruby
mit
19
main
5,010
require "rails_helper" require Rails.root.join("spec/services/datastore/data_access_api_stubs") RSpec.describe Test::DatastorePayloadsController do before do allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("development")) Rails.application.reload_routes! end after do allow(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/aggregated_cash_income_spec.rb
Ruby
mit
19
main
22,030
require "rails_helper" RSpec.describe AggregatedCashIncome do let(:aci) { described_class.new(legal_aid_application_id: application.id) } let!(:pension) { create(:transaction_type, :pension) } let(:month1_tx_date) { Time.zone.today.beginning_of_month - 1.month } let(:month2_tx_date) { Time.zone.today.beginning...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/savings_amount_spec.rb
Ruby
mit
19
main
1,196
require "rails_helper" RSpec.describe SavingsAmount do describe "#positive" do subject(:savings_amount) { create(:savings_amount) } context "with no savings" do it "is negative" do expect(savings_amount.positive?).to be(false) end end context "with some savings" do before ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/address_spec.rb
Ruby
mit
19
main
1,369
require "rails_helper" RSpec.describe Address do subject(:model) { build(:address) } describe ".pretty_postcode" do it "can display the postcode with a space reinserted" do model.postcode = "SW1H9AJ" expect(model.pretty_postcode).to eq("SW1H 9AJ") end it "returns nil if the postcode is ni...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/attachment_spec.rb
Ruby
mit
19
main
738
require "rails_helper" RSpec.describe Attachment do let!(:soc1) { create(:attachment) } let!(:soc2) { create(:attachment) } let!(:merits1) { create(:attachment, :merits_report) } let!(:merits2) { create(:attachment, :merits_report) } let!(:means1) { create(:attachment, :means_report) } let!(:bank) { create...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/policy_disregards_spec.rb
Ruby
mit
19
main
413
require "rails_helper" RSpec.describe PolicyDisregards do let(:application) { create(:legal_aid_application, :with_single_policy_disregard) } let(:expected_json) do { category: "policy_disregards", details: %w[vaccine_damage_payments], } end describe "as_json" do subject(:as_json) { a...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/firm_spec.rb
Ruby
mit
19
main
1,416
require "rails_helper" RSpec.describe "Firm" do let!(:firm) { create(:firm, name: "Testing, Test & Co") } describe "#permissions" do context "when there are no permissions" do let(:firm_with_no_permission) { create(:firm) } it "returns no permissions" do expect(firm_with_no_permission.rel...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/partner_spec.rb
Ruby
mit
19
main
539
require "rails_helper" RSpec.describe Partner do subject(:new_partner) { described_class.create(legal_aid_application:) } let(:legal_aid_application) { create(:legal_aid_application) } describe "on validation" do before do new_partner.first_name = "John" new_partner.last_name = "Doe" new_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/other_assets_declaration_spec.rb
Ruby
mit
19
main
962
require "rails_helper" RSpec.describe OtherAssetsDeclaration do describe "unique index on legal_aid_application_id" do it "throws an exception if you attempt to create a second record for an application" do application = create(:legal_aid_application) application.create_other_assets_declaration! ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/scope_limitation_spec.rb
Ruby
mit
19
main
1,459
require "rails_helper" RSpec.describe ScopeLimitation do subject { described_class.new } it { is_expected.to define_enum_for(:scope_type).with_values(%i[substantive emergency]) } describe "#description" do subject(:sl_description) { scope_limitation.description } let(:scope_limitation) { create(:scope...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/scheduled_mailing_spec.rb
Ruby
mit
19
main
3,797
require "rails_helper" RSpec.describe ScheduledMailing do let(:mailer_klass) { "NotifyMailer" } let(:mailer_method) { "notify" } let(:legal_aid_application) { create(:legal_aid_application) } let(:addressee) { Faker::Internet.email } let(:mailer_args) { [:one, :two, "three"] } let(:frozen_time) { Time.zone...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/capital_disregard_spec.rb
Ruby
mit
19
main
1,577
require "rails_helper" RSpec.describe CapitalDisregard do let(:capital_disregard) { create(:capital_disregard) } describe "incomplete?" do subject { capital_disregard.incomplete? } let(:capital_disregard) do create(:capital_disregard, :discretionary, payment_reason:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/setting_spec.rb
Ruby
mit
19
main
2,932
require "rails_helper" RSpec.describe Setting do describe ".setting" do context "when there is no setting record" do before { described_class.delete_all } it "generates one with the default values" do rec = described_class.setting expect(rec.mock_true_layer_data?).to be false ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/provider_spec.rb
Ruby
mit
19
main
6,440
require "rails_helper" RSpec.describe Provider do it_behaves_like "a reauthable model" describe "#user_permissions" do context "with no permissions for provider and their firm" do let(:firm) { create(:firm, :with_no_permissions) } let(:provider) { create(:provider, :with_no_permissions, firm:) } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/bank_account_spec.rb
Ruby
mit
19
main
3,939
require "rails_helper" RSpec.describe BankAccount do describe "#account_type_label" do let(:not_defined_account_type) { "LIFE_ISA" } it "maps the account_type from TrueLayer" do described_class::ACCOUNT_TYPE_LABELS.each do |key, val| bank_account = create(:bank_account, account_type: key) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/regular_transaction_spec.rb
Ruby
mit
19
main
3,616
require "rails_helper" RSpec.describe RegularTransaction do describe "#validate" do context "when amount is blank" do it "is invalid" do regular_transaction = build_stubbed(:regular_transaction, amount: nil) expect(regular_transaction).not_to be_valid expect(regular_transaction.err...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/vehicle_spec.rb
Ruby
mit
19
main
1,269
require "rails_helper" RSpec.describe Vehicle do describe "#purchased_on" do let(:vehicle) { create(:vehicle, more_than_three_years_old:) } describe "#complete?" do subject { vehicle.complete? } context "when all questions have been answered" do let(:vehicle) { create(:vehicle, estimate...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/host_env_spec.rb
Ruby
mit
19
main
6,194
require "rails_helper" RSpec.describe HostEnv do describe "host_env" do before do allow(ENV).to receive(:fetch).with("HOST_ENV", nil).and_return("my_host_env") end it "returns the HOST_ENV envvar values as a symbol" do expect(described_class.host_env).to eq :my_host_env end end cont...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/bank_transaction_spec.rb
Ruby
mit
19
main
2,696
require "rails_helper" RSpec.describe BankTransaction do describe "#parent_transaction_type" do before { Populators::TransactionTypePopulator.call } let(:benefits) { TransactionType.find_by(name: "benefits") } let(:excluded_benefits) { TransactionType.find_by(name: "excluded_benefits") } let(:pensio...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/legal_aid_application_transaction_type_spec.rb
Ruby
mit
19
main
5,589
require "rails_helper" RSpec.describe LegalAidApplicationTransactionType do let(:legal_aid_application) { create(:legal_aid_application, :with_applicant) } let(:credit_transaction_type) { create(:transaction_type, :credit_with_standard_name) } let(:debit_transaction_type) { create(:transaction_type, :debit_with_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/announcement_spec.rb
Ruby
mit
19
main
3,861
require "rails_helper" RSpec.describe Announcement do subject(:announcement) { described_class.build(params) } let(:display_type) { :gov_uk } let(:gov_uk_header_bar) { "Important" } let(:heading) { "Database update" } let(:link_display) { "Click for details" } let(:link_url) { "https://example.com" } le...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/benefit_check_result_spec.rb
Ruby
mit
19
main
1,536
require "rails_helper" RSpec.describe BenefitCheckResult do describe "#positive?" do context "when result is 'Yes'" do subject(:instance) { described_class.new(result: "Yes") } it "returns true" do expect(instance.positive?).to be true end end context "when result is 'yES'" do...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/proceeding_spec.rb
Ruby
mit
19
main
6,011
require "rails_helper" RSpec.describe Proceeding do let(:matter_code) { "KSEC8" } let(:df_used) { nil } let(:df_date) { nil } let(:emergency_level_of_service) { nil } let(:substantive_level_of_service) { nil } let(:proceeding) do create(:proceeding, :da001, proceeding_case_id: 55...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/aggregated_cash_outgoings_spec.rb
Ruby
mit
19
main
16,596
require "rails_helper" RSpec.describe AggregatedCashOutgoings do let(:aco) { described_class.new(legal_aid_application_id: application.id) } let(:month1_tx_date) { Time.zone.today.beginning_of_month - 1.month } let(:month2_tx_date) { Time.zone.today.beginning_of_month - 2.months } let(:month3_tx_date) { Time.z...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/application_digest_spec.rb
Ruby
mit
19
main
24,431
require "rails_helper" RSpec.describe ApplicationDigest do describe ".create_or_update!" do subject(:application_digest) { described_class.create_or_update!(laa.id) } let(:firm_name) { "Regional Legal Services" } let(:username) { "regional_user_1" } let(:firm) { create(:firm, name: firm_name) } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/transaction_type_spec.rb
Ruby
mit
19
main
5,925
require "rails_helper" RSpec.shared_context "with credit and debit transaction types" do let(:credit_transaction_type) { create(:transaction_type, :benefits) } let(:debit_transaction_type) { create(:transaction_type, :rent_or_mortgage) } before do credit_transaction_type debit_transaction_type end end...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/bank_holiday_spec.rb
Ruby
mit
19
main
1,401
require "rails_helper" RSpec.describe BankHoliday, vcr: { cassette_name: "gov_uk_bank_holiday_api", allow_playback_repeats: true } do let(:api_dates) { BankHolidayRetriever.dates } let!(:bank_holiday) { create(:bank_holiday) } describe ".dates" do context "when bank holiday data already exists" do it ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/linked_application_type_spec.rb
Ruby
mit
19
main
484
require "rails_helper" RSpec.describe LinkedApplicationType do describe ".all" do subject(:all_method) { described_class.all } it "returns a collection of Link type objects" do expect(all_method).to all(respond_to(:code, :description)) end it "returns expected collection attribute values" do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/document_category_spec.rb
Ruby
mit
19
main
1,939
require "rails_helper" RSpec.describe DocumentCategory do describe ".populate" do it "calls the document_category_populator service" do expect(DocumentCategoryPopulator).to receive(:call).with(no_args) described_class.populate end end describe ".displayable_document_category_names" do be...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/temp_contract_data_spec.rb
Ruby
mit
19
main
588
require "rails_helper" RSpec.describe TempContractData do subject(:record) { described_class.new(office_code:, response:) } let(:office_code) { "AB12345" } let(:response) do { test: "value" } end describe "validations" do context "when all variables set" do it { is_expected.to be_valid } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/applicant_spec.rb
Ruby
mit
19
main
18,513
require "rails_helper" RSpec.describe Applicant do describe "when creating an applicant record" do subject(:created_applicant) { described_class.create } it "leaves the has_partner field as nil" do expect(created_applicant.has_partner).to be_nil end end describe "on validation" do subject...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/dependant_spec.rb
Ruby
mit
19
main
5,942
require "rails_helper" RSpec.describe Dependant do let(:calculation_date) { Date.current } let(:legal_aid_application) { create(:legal_aid_application, :with_applicant, transaction_period_finish_on: calculation_date) } let(:dependant) { create(:dependant, legal_aid_application:, date_of_birth:) } describe "#o...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/true_layer_bank_spec.rb
Ruby
mit
19
main
1,690
require "rails_helper" RSpec.describe TrueLayerBank, vcr: { cassette_name: "true_layer_banks_api", allow_playback_repeats: true } do let(:api_banks) { TrueLayer::BanksRetriever.banks } let!(:true_layer_bank) { create(:true_layer_bank) } let(:enable_mock) { false } before do allow(Rails.configuration.x.tru...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/legal_aid_application_spec.rb
Ruby
mit
19
main
95,320
require "rails_helper" RSpec.describe LegalAidApplication do let(:legal_aid_application) { create(:legal_aid_application) } # Main purpose: to ensure relationships to other objects set so that destroying application destroys all objects # that then become redundant. describe ".destroy_all" do subject(:des...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cash_transaction_spec.rb
Ruby
mit
19
main
3,208
require "rails_helper" RSpec.describe CashTransaction do let(:application1) { create(:legal_aid_application, :with_applicant) } let(:application2) { create(:legal_aid_application, :with_applicant) } let(:benefits) { create(:transaction_type, :benefits) } let(:pension) { create(:transaction_type, :pension) } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/linked_application_spec.rb
Ruby
mit
19
main
2,249
require "rails_helper" RSpec.describe LinkedApplication do subject(:linked_application) do build(:linked_application, lead_application: laa_lead, associated_application: laa_associated, target_application: laa_target, link_type_code: link_type_text) end let(:laa_lead)...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/ccms/opponent_id_spec.rb
Ruby
mit
19
main
1,790
require "rails_helper" module CCMS RSpec.describe OpponentId do describe ".next_serial_id" do context "with no record in the ccms_opponent_ids table" do it "creates one record" do expect(described_class.count).to be_zero described_class.next_serial_id expect(described_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/ccms/submission_spec.rb
Ruby
mit
19
main
9,670
require "rails_helper" require "sidekiq/testing" module CCMS RSpec.describe Submission do let(:state) { :initialised } let(:applicant_poll_count) { 0 } let(:case_poll_count) { 0 } let(:legal_aid_application) { create(:legal_aid_application, :with_applicant, :with_other_assets_declaration, :with_savin...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/citizen/access_token_spec.rb
Ruby
mit
19
main
1,456
require "rails_helper" RSpec.describe Citizen::AccessToken do describe ".find_by_token" do subject(:find_by_token) { described_class.find_by_token(token) } let(:access_token) { create(:citizen_access_token, token:) } let(:token) { "find-this-token" } it "queries by deteministically encrypted token"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/proceeding_merits_task/chances_of_success_spec.rb
Ruby
mit
19
main
1,621
require "rails_helper" RSpec.describe ProceedingMeritsTask::ChancesOfSuccess do describe "#pretty_success_propsect" do let(:pt_da) { create(:proceeding_type, :with_real_data) } let(:pt_s8) { create(:proceeding_type, :as_section_8_child_residence) } let(:legal_aid_application) do create(:legal_aid_a...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/proceeding_merits_task/proceeding_linked_child_spec.rb
Ruby
mit
19
main
1,050
require "rails_helper" module ProceedingMeritsTask RSpec.describe ProceedingLinkedChild do context "when validation of correct involved child" do let(:laa) { create(:legal_aid_application) } let(:other_laa) { create(:legal_aid_application) } let(:proceeding) { create(:proceeding, :da001, legal_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/application_merits_task/individual_spec.rb
Ruby
mit
19
main
1,249
require "rails_helper" module ApplicationMeritsTask RSpec.describe Individual do subject(:individual) { build(:individual) } it { expect(individual.ccms_other_party_type).to eq "PERSON" } it { expect(individual.ccms_relationship_to_case).to eq "OPP" } it { expect(individual.ccms_relationship_to_clie...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/application_merits_task/involved_child_spec.rb
Ruby
mit
19
main
1,935
require "rails_helper" module ApplicationMeritsTask RSpec.describe InvolvedChild do describe "standard values" do subject(:involved_child) { build(:involved_child) } it { expect(involved_child.ccms_other_party_type).to eq "PERSON" } it { expect(involved_child.ccms_relationship_to_case).to eq "...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/application_merits_task/opponent_spec.rb
Ruby
mit
19
main
5,335
require "rails_helper" module ApplicationMeritsTask RSpec.describe Opponent do describe "scopes" do before do create(:opponent, :for_individual) create(:opponent, :for_organisation) end describe ".individuals" do subject(:individuals) { described_class.individuals } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/application_merits_task/organisation_spec.rb
Ruby
mit
19
main
1,722
require "rails_helper" module ApplicationMeritsTask RSpec.describe Organisation do subject(:organisation) { build(:organisation) } it { expect(organisation.ccms_other_party_type).to eq "ORGANISATION" } it { expect(organisation.ccms_relationship_to_case).to eq "OPP" } it { expect(organisation.ccms_re...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/hmrc/response_spec.rb
Ruby
mit
19
main
7,315
require "rails_helper" RSpec.describe HMRC::Response do subject(:response) { build(:hmrc_response, owner_id: applicant.id, owner_type: applicant.class) } let(:legal_aid_application) { create(:legal_aid_application, :with_applicant) } let(:applicant) { legal_aid_application.applicant } context "when validatin...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/legal_framework/merits_task_list_spec.rb
Ruby
mit
19
main
6,009
require "rails_helper" module LegalFramework RSpec.describe MeritsTaskList do let(:application) { create(:legal_aid_application, :with_proceedings, :with_multiple_proceedings_inc_section8) } let(:merits_task_list) { described_class.create!(legal_aid_application_id: application.id, serialized_data: dummy_seri...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/legal_framework/serializable_merits_task_list_spec.rb
Ruby
mit
19
main
5,370
require "rails_helper" module LegalFramework RSpec.describe SerializableMeritsTaskList do before do create(:proceeding, :da004) create(:proceeding, :da001) end let(:smtl) { described_class.new(dummy_response_hash) } describe ".new" do it "instantiates a new object" do expe...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/legal_framework/serializable_merits_task_spec.rb
Ruby
mit
19
main
3,772
require "rails_helper" module LegalFramework RSpec.describe SerializableMeritsTask do let(:serialized_merits_task) { described_class.new(:proceeding_children, dependencies: [:application_children]) } describe ".new" do it "instantiates a new object" do expect(serialized_merits_task.name).to eq...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/concerns/cfe_submission_state_machine_spec.rb
Ruby
mit
19
main
11,966
require "rails_helper" module CFE RSpec.describe CFESubmissionStateMachine do context "with initial state" do it "creates an application in initialised state" do submission = create(:cfe_submission) expect(submission.initialised?).to be true end end context "with assessment_c...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/submission_spec.rb
Ruby
mit
19
main
385
require "rails_helper" RSpec.describe CFE::Submission do subject(:instance) { described_class.new } it { expect(instance).to delegate_method(:passported?).to(:legal_aid_application) } it { expect(instance).to delegate_method(:non_passported?).to(:legal_aid_application) } it { expect(instance).to delegate_meth...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/remarked_transaction_spec.rb
Ruby
mit
19
main
1,671
require "rails_helper" module CFE RSpec.describe RemarkedTransaction do let(:tx_id) { SecureRandom.uuid } let(:category) { :state_benefits } let(:transaction) { described_class.new(tx_id, category, :unknown_frequency) } describe ".new" do it "instantiates a transaction with one reason" do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/remarks_spec.rb
Ruby
mit
19
main
9,463
require "rails_helper" module CFE RSpec.describe Remarks do let(:remarks) { described_class.new(remarks_hash) } describe "#caseworker_review_required?" do context "with no remarks" do let(:remarks_hash) { empty_hash } it "returns false" do expect(remarks.caseworker_review_re...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/remarked_transaction_collection_spec.rb
Ruby
mit
19
main
1,575
require "rails_helper" module CFE RSpec.describe RemarkedTransactionCollection do describe "#transactions" do let(:collection) { described_class.new } context "with empty collection" do it "returns an empty hash" do expect(collection.transactions).to eq({}) end end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/v2/result_spec.rb
Ruby
mit
19
main
21,817
require "rails_helper" module CFE module V2 RSpec.describe Result do let(:eligible_result) { create(:cfe_v2_result) } let(:not_eligible_result) { create(:cfe_v2_result, :not_eligible) } let(:contribution_required_result) { create(:cfe_v2_result, :with_capital_contribution_required) } let(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/v6/with_partner_result_spec.rb
Ruby
mit
19
main
18,523
require "rails_helper" module CFE module V6 RSpec.describe Result do let(:cfe_result) { create(:cfe_v6_result, :with_employments, :with_partner) } # INCOME SUMMARIES describe "gross_income_breakdown" do context "with partner set to false" do let(:partner) { false } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/v6/result_spec.rb
Ruby
mit
19
main
25,990
require "rails_helper" module CFE module V6 RSpec.describe Result do let(:cfe_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_in...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/v1/result_spec.rb
Ruby
mit
19
main
6,546
require "rails_helper" module CFE module V1 RSpec.describe Result do let(:eligible_result) { create(:cfe_v1_result) } let(:not_eligible_result) { create(:cfe_v1_result, :not_eligible) } let(:contribution_required_result) { create(:cfe_v1_result, :contribution_required) } let(:contribution...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/v3/result_spec.rb
Ruby
mit
19
main
20,540
require "rails_helper" module CFE module V3 RSpec.describe Result do let(:eligible_result) { create(:cfe_v3_result) } let(:not_eligible_result) { create(:cfe_v3_result, :not_eligible) } let(:contribution_required_result) { create(:cfe_v3_result, :with_capital_contribution_required) } let(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/v4/result_spec.rb
Ruby
mit
19
main
28,304
require "rails_helper" module CFE module V4 RSpec.describe Result do let(:eligible_result) { create(:cfe_v4_result) } let(:partially_eligible_result) { create(:cfe_v4_result, :partially_eligible) } let(:not_eligible_result) { create(:cfe_v4_result, :not_eligible) } let(:contribution_requi...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/models/cfe/empty/result_spec.rb
Ruby
mit
19
main
13,149
require "rails_helper" module CFE module Empty RSpec.describe Result do let(:empty_cfe_result) { create(:cfe_empty_result) } let(:legal_aid_application) { create(:legal_aid_application, :with_cfe_empty_result) } let(:manual_review_determiner) { CCMS::ManualReviewDeterminer.new(application) } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
ccms_integration/helpers/ccms_payload_analyser.rb
Ruby
mit
19
main
1,345
require "nokogiri" require "csv" # # This class is useful for printing out all the attributes in the merits and means sections of a ccms payload file # # class CCMSPayloadAnalyser def initialize @doc = Rails.root.join("ccms_integration/example_payloads/NonPassportedFullMonty.xml").open { |f| Nokogiri::XML(f).rem...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_hmrc_responses.rake
Ruby
mit
19
main
1,498
namespace :migrate do desc "AP-3805: Migrate the ownership of HMRC responses to applicant" # This will allow future HMRC responses to be assigned to partner task hmrc_responses: :environment do responses = HMRC::Response.all Rails.logger.info "Migrating HMRC responses => Applicant" Rails.logger.info "...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_statement_of_case.rake
Ruby
mit
19
main
2,226
def count_mismatch?(records, upload_target, text_target) upload_target -= remove_missing_socs? [ records.where(upload: true).count != upload_target, records.where(typed: true).count != text_target, ].any?(true) end def remove_missing_socs? # sometimes, the statement of case is not created - a bug has b...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_dwp_page_steps.rake
Ruby
mit
19
main
3,607
namespace :migrate do # # The new DWP flow logic will go to various new controllers/pages/forms based on partner existence, positive, negative # (or unavailable) response from DWP Benefit checker. Rather than determine what step each application should be # we force them back to the check provider answers page...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/update_provider_step_to_nino_page.rake
Ruby
mit
19
main
2,957
namespace :migrate do desc "AP-5970 move in progress applications to location of new nino page" task move_to_nino_page: :environment do addresses_pages = %w[ correspondence_address_choices correspondence_address_lookups correspondence_address_selections correspondence_address_manuals ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_involved_child_provider_step_params.rake
Ruby
mit
19
main
1,855
namespace :migrate do desc "AP-6656: Migrate involved_child provider_step_params" # Rake task to update provider_step_params where provider_step involved_children. # Call with "rake migrate:migrate_involved_child_provider_step_params[mock]" # e.g. rake "migrate:migrate_involved_child_provider_step_params[false]...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_laa_transaction_type_ownership.rake
Ruby
mit
19
main
1,775
namespace :migrate do desc "AP-4285: Migrate the ownership of legal_aid_application_transaction_types to applicant" # This will allow future legal_aid_application_transaction_types to be assigned to partner task legal_aid_application_transaction_types_ownership: :environment do records = LegalAidApplicationTr...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_property_pages.rake
Ruby
mit
19
main
1,756
namespace :migrate do desc "AP-4132 migrate provider_step from old property pages to new property_details page" task property_pages: :environment do property_pages = %w[property_values outstanding_mortgages shared_ownerships percentage_homes] applications = LegalAidApplication.where(provider_step: property...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_scope_limitations.rake
Ruby
mit
19
main
3,057
namespace :migrate do desc "AP-3495: Migrate the scope_limitation data from proceedings into their own table" # This was done as a rake task as it was taking ~50 seconds to run when deploying to K8s # and exceeding the liveness checks task scope_limitations: :environment do total = Proceeding.count comp...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_cash_transaction_ownership.rake
Ruby
mit
19
main
1,528
namespace :migrate do desc "AP-4285: Migrate the ownership of cash transactions to applicant" # This will allow future employments to be assigned to partner task cash_transaction_ownership: :environment do records = CashTransaction.all Rails.logger.info "Migrating cash_transaction => Applicant" Rails....
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_extra_employment_information.rake
Ruby
mit
19
main
1,896
namespace :migrate do desc "AP-4326 migrate extra_employment_information and employment_information_details from LegalAidApplication to Applicant" task extra_employment_information: :environment do applications = LegalAidApplication.all Rails.logger.info "Migrating legal aid applications: retrieving all ap...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/bank_statement_upload.rake
Ruby
mit
19
main
597
desc "Temporary task to set bank statement upload permissions up on localhost" task bank_statement_upload: :environment do raise "rake bank_statement_upload can only be used in development" if HostEnv.production? bank_statement_upload_permission = Permission.find_by(role: "application.non_passported.bank_statement...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_employments.rake
Ruby
mit
19
main
1,460
namespace :migrate do desc "AP-3805: Migrate the ownership of employments to applicant" # This will allow future employments to be assigned to partner task employments: :environment do records = Employment.all Rails.logger.info "Migrating employments => Applicant" Rails.logger.info "------------------...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/db.rake
Ruby
mit
19
main
1,837
def build_postgres_url config = Rails.configuration.database_configuration host = config[Rails.env]["host"] database = config[Rails.env]["database"] username = config[Rails.env]["username"] password = config[Rails.env]["password"] "postgres://#{username}:#{password}@#{host}:5432/#{database}" end names...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/add_vehicle_ownership.rake
Ruby
mit
19
main
1,217
namespace :migrate do desc "AP-4138: Add the owner of vehicles to exiting applications" task vehicle_ownership: :environment do records = Vehicle.all Rails.logger.info "Add vehicle ownership => Applicant" Rails.logger.info "----------------------------------------" Rails.logger.info "vehicle.count:...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_vehicle_provider_steps.rake
Ruby
mit
19
main
1,935
namespace :migrate do desc "AP-4132 migrate provider_step from old vehicle pages to new vehicle_details page" task vehicle_pages: :environment do vehicle_pages = %w[vehicles_ages vehicles_estimated_values vehicles_remaining_payments vehicles_regular_uses] applications = LegalAidApplication.where(provider_s...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/simplecov_parallel.rake
Ruby
mit
19
main
370
# frozen_string_literal: true if ENV["CIRCLE_JOB"] namespace :simplecov do desc "Process coverage results" task process_coverage: :environment do require "simplecov" SimpleCov.collate Dir["./coverage_results/.resultset*.json"], "rails" do minimum_coverage line: 100 refuse_coverag...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_remove_opponent_step.rake
Ruby
mit
19
main
1,863
namespace :migrate do desc "AP-6388 migrate provider_step from remove_opponent to opponent_types/has_other_opponents" task :remove_opponent_step, [:dry_run] => :environment do |_task, args| dry_run = args.dry_run != "false" application_ids = LegalAidApplication.where(provider_step: "remove_opponent").ids ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_involved_children_names.rake
Ruby
mit
19
main
1,473
namespace :migrate do desc "AP-6656: Populate involved children first and last names from their full name" # Rake task to populate involved children first and last names from their full name. # Call with "rake migrate:migrate_involved_children_names[mock]" # e.g. rake "migrate:migrate_involved_children_names[fa...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/storage.rake
Ruby
mit
19
main
269
namespace :storage do desc "Clears the storage directory" task clear: :environment do raise "Only available in development environment" unless Rails.env.development? system "rm -rf #{Rails.root.join('storage')}" Attachment.all.map(&:destroy) end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/delete_orphan_applicants.rake
Ruby
mit
19
main
1,078
namespace :migrate do desc "AP-6563: Delete applicants that are not associated with a LegalAidApplication" # Rake task to delete applicants that are not associated with a LegalAidApplication. # Call with "rake migrate:delete_orphan_applicants[mock]" # e.g. rake "migrate:delete_orphan_applicants[false]" # Runn...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/ccms_submissions.rake
Ruby
mit
19
main
472
namespace :ccms_submissions do desc "Turn off ccms submissions" task turn_off: :environment do ScheduledCCMSSubmissionsToggleJob.perform_later(:turn_off) end desc "Turn on ccms submissions" task turn_on: :environment do ScheduledCCMSSubmissionsToggleJob.perform_later(:turn_on) end desc "Send sla...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/purge.rake
Ruby
mit
19
main
245
namespace :purge do desc "Mark old records as purgeable" task mark: :environment do MarkPurgeableService.call end desc "Destroy records marked as purgeable" task destroy: :environment do DestroyPurgeableService.call end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/digest.rake
Ruby
mit
19
main
893
def warning_message(task_name) <<~WARNING.freeze Digest rake tasks are deactivated on UAT environments, call with BYPASS=true rake digest:#{task_name} To bypass the UAT block WARNING end namespace :digest do desc "Run DigestExtractor to update application digests" task extract: :environment do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/cucumber_steps.rake
Ruby
mit
19
main
838
# rubocop:disable Rails/RakeEnvironment StepStruct = Struct.new(:stepname, :location) namespace :cucumber do desc "List all defined steps" task :steps do require "hirb" extend Hirb::Console puts "CUCUMBER steps:" puts "" step_definition_dir = "features/step_definitions" results = [] D...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/setup_db_for_testing.rake
Ruby
mit
19
main
522
namespace :settings do desc "Sets settings to values for integration testing" task integration: :environment do setting = Setting.setting setting.update!(mock_true_layer_data: true, bank_transaction_filename: "db/sample_data/bank_transactions_2.csv", manually_review_a...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/cfe_printer.rake
Ruby
mit
19
main
972
namespace :cfe do desc "display transactions sent to cfe for an application: rake cfe:display[L-ABC-123]" task :display, [:application_ref] => :environment do |_task, args| if args[:application_ref].nil? puts "**** Missing application reference ****" puts "Specify application reference as follows: r...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_partner_attachments.rake
Ruby
mit
19
main
2,348
namespace :migrate do desc "AP-5141 migrate attachment names after length exceeded CCMS limits" task partner_attachments: :environment do changes = { partner_bank_statement_evidence: "part_bank_state_evidence", partner_bank_statement_evidence_pdf: "part_bank_state_evidence_pdf", partner_emplo...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/migrate_opponents.rake
Ruby
mit
19
main
3,674
COMMON_ATTRIBUTES = %w[id first_name last_name ccms_opponent_id].freeze DAS_ATTRIBUTES = %w[warning_letter_sent warning_letter_sent_details police_notified police_notified_details bail_conditions_set bail_conditions_set_details].freeze OMC_ATTRIBUTES = %w[understands_terms_of_court_order understands_terms_of_court_orde...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/helpers/cfe_api_displayer.rb
Ruby
mit
19
main
1,537
class CfeApiDisplayer def initialize(application_ref) @legal_aid_application = LegalAidApplication.find_by(application_ref:) end def run display_bank_transactions display_cfe_submission_history end private def categorised_bank_transactions @categorised_bank_transactions ||= @legal_aid_appli...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/helpers/cy_helper.rb
Ruby
mit
19
main
1,543
class CyHelper FILES_TO_TRANSLATE = %w[ accessibility_statement activemodel activerecord citizens contacts currency dates enums errors feedback generic helpers layouts privacy_policy shared transaction_types true_layer_errors ].freeze def initia...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
lib/tasks/helpers/cfe_payload_recorder.rb
Ruby
mit
19
main
1,173
class CfePayloadRecorder def self.call(application_ref) new(application_ref).call end def initialize(application_ref) @legal_aid_application = LegalAidApplication.find_by(application_ref:) raise ArgumentError, "No such application" if @legal_aid_application.nil? @recording = [] end def call...