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
db/migrate/20191206104140_drop_benefit_types.rb
Ruby
mit
19
main
244
class DropBenefitTypes < ActiveRecord::Migration[5.2] def change drop_table :benefit_types, id: :uuid do |t| t.string :label t.text :description t.boolean :exclude_from_gross_income t.timestamps end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20251209160131_create_datastore_submissions.rb
Ruby
mit
19
main
325
class CreateDatastoreSubmissions < ActiveRecord::Migration[8.1] def change create_table :datastore_submissions, id: :uuid do |t| t.integer :status t.text :body t.jsonb :headers t.belongs_to :legal_aid_application, null: false, foreign_key: true, type: :uuid t.timestamps end end...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20221013114916_create_allegation.rb
Ruby
mit
19
main
307
class CreateAllegation < ActiveRecord::Migration[7.0] def change create_table :allegations, id: :uuid do |t| t.belongs_to :legal_aid_application, null: false, foreign_key: true, type: :uuid t.boolean :denies_all t.string :additional_information t.timestamps end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20230226113130_create_domestic_abuse_summary.rb
Ruby
mit
19
main
492
class CreateDomesticAbuseSummary < ActiveRecord::Migration[7.0] def change create_table :domestic_abuse_summaries, id: :uuid do |t| t.belongs_to :legal_aid_application, foreign_key: true, null: false, type: :uuid t.boolean :warning_letter_sent t.text :warning_letter_sent_details t.boolean ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20211004135707_create_proceedings.rb
Ruby
mit
19
main
1,132
class CreateProceedings < ActiveRecord::Migration[6.1] def change create_table :proceedings, id: :uuid do |t| t.belongs_to :legal_aid_application, foreign_key: true, null: false, type: :uuid t.integer :proceeding_case_id, null: true t.boolean :lead_proceeding, default: false, null: false t...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20231020085303_add_copy_case_to_legal_aid_application.rb
Ruby
mit
19
main
215
class AddCopyCaseToLegalAidApplication < ActiveRecord::Migration[7.0] def change add_column :legal_aid_applications, :copy_case, :boolean add_column :legal_aid_applications, :copy_case_id, :uuid end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20230803135557_remove_means_test_review_phase_one_from_settings.rb
Ruby
mit
19
main
231
class RemoveMeansTestReviewPhaseOneFromSettings < ActiveRecord::Migration[7.0] def change safety_assured do remove_column :settings, :means_test_review_phase_one, :boolean, null: false, default: false end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20210401124208_create_legal_framework_submissions.rb
Ruby
mit
19
main
333
class CreateLegalFrameworkSubmissions < ActiveRecord::Migration[6.1] def change create_table :legal_framework_submissions, id: :uuid do |t| t.references :legal_aid_application, foreign_key: true, type: :uuid t.uuid :request_id t.string :error_message t.text :result t.timestamps e...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/migrate/20200410144915_add_transaction_file_name_to_settings.rb
Ruby
mit
19
main
204
class AddTransactionFileNameToSettings < ActiveRecord::Migration[6.0] def change add_column :settings, :bank_transaction_filename, :string, default: "db/sample_data/bank_transactions.csv" end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/anonymise/rules.rb
Ruby
mit
19
main
7,476
require "faker" # If you see a "extra data after last expected column" when attempting to restore # it means that the final column in the table has been anonymized and it removes # the newline. If this occurs on a new table, change the final column in the # table, check the output, and add a new line character after ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/seeds/permissions.rb
Ruby
mit
19
main
849
class PermissionsPopulator ROLES = { # "example.permission.group" => "Description of example group", }.freeze def self.run ROLES.each do |role, description| Permission.create!(role:, description:) if Permission.find_by(role:).nil? end end def self.tidy Permission.find_each do |permissi...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
db/seeds/test_provider_populator.rb
Ruby
mit
19
main
3,567
class TestProviderPopulator TEST_FIRMS = { "Test & Co" => [823, %w[1T823E 2T823E 3T823E]], "Will-c & Co." => [910, %w[1W910I]], "Test-sch & Co." => [1137, %w[2T113E:1 3T113E:2 4T113E:3 5T113E:4]], "Test2 & Co." => [824, %w[1T824E:5 2T824E:6 3T824E:7 4T824E:8]], "Test3 & Co." => [825, %w[3T823E:9 2...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/vcr.rb
Ruby
mit
19
main
1,976
require "vcr" vcr_debug = ENV["VCR_DEBUG"].to_s == "true" record_mode = ENV["VCR_RECORD_MODE"] ? ENV["VCR_RECORD_MODE"].to_sym : :once Capybara.server_port = 8234 VCR.configure do |vcr_config| vcr_config.cassette_library_dir = "features/cassettes" vcr_config.hook_into :faraday, :webmock vcr_config.default_casse...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/hooks.rb
Ruby
mit
19
main
4,320
require "super_diff/rspec-rails" require Rails.root.join("spec/services/pda/provider_details_request_stubs") require Rails.root.join("spec/support/bank_holiday_retriever_stubs") # before, after and around hooks for feature tests # Before("@hmrc_use_dev_mock") do allow(Rails.configuration.x).to receive(:hmrc_use_dev_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/puffing_billy_helper.rb
Ruby
mit
19
main
30,692
module PuffingBillyHelper def stub_organisation_search_for(term) body = organisation_search_term_stubs[term] proxy .stub("https://legal-framework-api-staging.cloud-platform.service.justice.gov.uk:443/organisation_searches", method: "post") .and_return( headers: { "Access-Control...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/env.rb
Ruby
mit
19
main
5,645
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # It is recommended to regenerate this file in the future when you upgrade to a # newer version of cucumber-rails. Consider adding your own code to a new file # instead of editing this one. Cucumber will automatically load all features/**/*...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/puffing_billy.rb
Ruby
mit
19
main
2,060
require "billy/capybara/cucumber" # if you want to record a request and response in order to generate a stub you can # 1. comment out/remove any proxy.stubs in use # 2. set non_whitelisted_requests_disabled = false (see below) # 3. ensure cache = true and persist_cache = true # Billy.configure do |c| c.cache = true ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/wait_for_ajax.rb
Ruby
mit
19
main
273
module WaitForAjax def wait_for_ajax(wait: Capybara.default_max_wait_time) Timeout.timeout(wait) do loop until finished_all_ajax_requests? end end def finished_all_ajax_requests? page.evaluate_script("$.active").zero? end end World(WaitForAjax)
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/steps_helper.rb
Ruby
mit
19
main
4,559
Then("I should be on a page showing {string}") do |title| expect(page).to have_content(title) end Then("I should be on a page showing {string} with a date of {int} days ago using {string} format") do |title, num_days, format| expect(page).to have_content("#{title} #{num_days.days.ago.strftime(format)}") end Then(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/support/screenshot_helper.rb
Ruby
mit
19
main
995
module ScreenshotHelper # selenium headless chrome solution for full screenshot def screenshot_and_open_image file_path = screenshot_image Launchy.open file_path end # TODO: Colin Bruce 17 May 2024 # This cop was disabled as we use this to debug test failures # rubocop:disable Lint/Debugger def s...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/generic_steps.rb
Ruby
mit
19
main
5,093
Then("I should be on a page with title {string}") do |title| expect(page).to have_title(title) end Then("I should be on a new tab with title {string}") do |title| new_tab = page.windows.last page.switch_to_window(new_tab) expect(page).to have_title(title) end Then("I should be on a page with title matching {s...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/bank_statement_upload_steps.rb
Ruby
mit
19
main
4,685
Given "I have completed a non-passported employed application with bank statements as far as the open banking consent page" do @legal_aid_application = create( :legal_aid_application, :with_proceedings, :with_employed_applicant, :with_non_passported_state_machine, :with_transaction_period, :pr...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/sign_in_steps.rb
Ruby
mit
19
main
1,955
Given(/^I am logged in as a provider$/) do @registered_provider = create_provider_with_firm_and_office login_as @registered_provider end Given("I am logged in as a provider with silas_id {string}") do |silas_id| @registered_provider = create_provider_with_firm_and_office(silas_id) login_as @registered_provid...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/debug_steps.rb
Ruby
mit
19
main
478
# rubocop:disable Lint/Debugger When("I bind and pry") do binding.pry end When(/^I save and open page$/) do save_and_open_page end # rubocop:enable Lint/Debugger When(/^I save and open screenshot$/) do screenshot_and_open_image end When(/^the feature flag for (.*?) is (enabled|disabled)$/) do |flag, enabled| ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/review_and_print_steps.rb
Ruby
mit
19
main
8,185
Given("I have completed a bank statement upload application with merits") do @legal_aid_application = create( :legal_aid_application, :with_proceedings, :with_employed_applicant, :with_non_passported_state_machine, :with_maintenance_in_regular_transaction, :with_rent_or_mortgage_regular_transa...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/evidence_upload_steps.rb
Ruby
mit
19
main
2,810
When("I have completed a non-passported application and reached the evidence upload page") do @legal_aid_application = create( :application, :with_applicant, :with_non_passported_state_machine, :with_domestic_abuse_summary, :with_merits_statement_of_case, :with_opponent, :with_incident, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/applicant_detail_steps.rb
Ruby
mit
19
main
905
When("I enter a date of birth that will make me 16 today") do dob = 16.years.ago fill_in("applicant_date_of_birth_3i", with: dob.day) fill_in("applicant_date_of_birth_2i", with: dob.month) fill_in("applicant_date_of_birth_1i", with: dob.year) end When("I enter a date of birth that will make me 18 tomorrow") do...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/regression_steps.rb
Ruby
mit
19
main
1,173
When("I visit the check income answers page") do visit(providers_legal_aid_application_means_check_income_answers_path(@legal_aid_application)) end When(/^the client has a (credit|debit) transaction named (.*) categorised as (.*)$/) do |type, description, category| bank_account = @legal_aid_application.applicant.b...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/employment_setup_steps.rb
Ruby
mit
19
main
1,515
Given(/^an applicant named (\S+) (\S+) has completed his true layer interaction$/) do |first_name, last_name| @applicant = FactoryBot.create :applicant, :employed, "#{first_name}_#{last_name}".downcase.to_sym, with_bank...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/means_report_steps.rb
Ruby
mit
19
main
12,392
Given(/^I have completed a non-passported (employed|employed with partner) application with bank statement uploads$/) do |optional_partner| @legal_aid_application = create( :legal_aid_application, :with_proceedings, :with_employed_applicant_and_extra_info, :with_employed_partner_and_extra_info, :w...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/merits_report_steps.rb
Ruby
mit
19
main
4,229
Given("I complete the journey as far as check merits answers with multiple proceedings with delegated functions") do matter_opposition = create(:matter_opposition) allegation = create(:allegation) undertaking = create(:undertaking) @legal_aid_application = create( :application, :with_applicant, :wit...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/ccms_auto_grant_steps.rb
Ruby
mit
19
main
333
Then("the application should be auto granted in CCMS") do expect(CCMS::ManualReviewDeterminer.new(@legal_aid_application).manual_review_required?).to be false end Then("the application must be manually reviewed in CCMS") do expect(CCMS::ManualReviewDeterminer.new(@legal_aid_application).manual_review_required?).to...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/linked_cases_steps.rb
Ruby
mit
19
main
4,198
Given("I have created and submitted an application with the application reference {string}") do |application_ref| @legal_aid_application = create( :legal_aid_application, :with_everything, :with_passported_state_machine, :with_merits_submitted, :with_proceedings, applicant: create(:applicant, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/check_merits_answers.rb
Ruby
mit
19
main
3,250
Given("I complete the journey as far as check merits answers with a PLF proceeding with second appeal question") do @legal_aid_application = create( :legal_aid_application, :with_non_passported_state_machine, :with_positive_benefit_check_result, :with_proceedings, :with_applicant, :with_oppone...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/merits_task_steps.rb
Ruby
mit
19
main
2,249
Given("I previously created a passported application with multiple_proceedings and left on the {string} page") do |provider_step| @legal_aid_application = create( :application, :with_applicant, :without_own_home, :with_multiple_proceeding_types_inc_section8, :with_no_other_assets, :with_policy...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/check_your_answers_steps.rb
Ruby
mit
19
main
12,490
require "rspec/expectations" Given("I have completed the income section of a non-passported application with open banking transactions") do @legal_aid_application = create( :legal_aid_application, :with_proceedings, :with_employed_applicant, :with_non_passported_state_machine, :with_fixed_offline...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/partner_employment_steps.rb
Ruby
mit
19
main
1,279
Then("I have completed an application where client and partner are both employed and {string} have/has additional information") do |extra_info| @legal_aid_application = create( :legal_aid_application, :with_proceedings, :with_employed_applicant_and_employed_partner, :with_non_passported_state_machine,...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/cookie_steps.rb
Ruby
mit
19
main
1,079
Given("I have not yet updated my cookie preferences") do @registered_provider.update(cookies_enabled: nil) end Given("I start the journey without cookie preferences") do steps %( Given I am logged in as a provider And I have not yet updated my cookie preferences When I visit the application service ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/admin_steps.rb
Ruby
mit
19
main
1,394
Given(/^I am logged in as an admin$/) do admin_user = create(:admin_user, username: "apply_maintenance", email: Faker::Internet.email) OmniAuth.config.test_mode = true OmniAuth.config.add_mock( :admin_entra_id, info: { email: admin_user.email }, origin: admin_settings_url, ) visit admin_root_pat...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/merits_task_list_steps.rb
Ruby
mit
19
main
1,318
Given("I complete the journey as far as merits task list for a PLF proceeding with second appeal question") do @legal_aid_application = create( :legal_aid_application, :with_non_means_tested_state_machine, :with_positive_benefit_check_result, :with_proceedings, :with_applicant, :provider_enter...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/copy_case.rb
Ruby
mit
19
main
276
Given("I have previously created an application with reference {string}") do |application_ref| create(:legal_aid_application, :with_passported_state_machine, :at_assessment_submitted, application_ref:, provider: @registered_provider) end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/check_provider_answers_steps.rb
Ruby
mit
19
main
3,254
Then("the \"Client details\" check your answers section should contain:") do |table| expect_questions_and_answers_in(selector: "#app-check-your-answers__client_details__summary", expected: table) end Then("the \"Client details\" check your answers section should not contain:") do |table| expect_questions_in(select...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/citizens_steps.rb
Ruby
mit
19
main
3,388
Given("An application has been created") do @legal_aid_application = create( :application, :with_applicant, :with_no_savings, :with_no_other_assets, :with_non_passported_state_machine, :applicant_entering_means, provider: create(:provider), transaction_period_finish_on: "2019-07-01", ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/partner_means_check.rb
Ruby
mit
19
main
3,208
Given("I complete the journey as far as regular outgoings") do @legal_aid_application = create( :legal_aid_application, :with_proceedings, :with_applicant_and_partner, :with_non_passported_state_machine, :provider_confirming_applicant_eligibility, ) create :hmrc_response, :use_case_one, legal...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
features/step_definitions/civil_journey_steps.rb
Ruby
mit
19
main
52,923
# features/step_definitions/civil_application_journey.feature Given(/^I visit the application service$/) do visit providers_root_path end Given("I visit the select office page") do visit providers_select_office_path end Given("I visit the confirm office page") do visit providers_confirm_office_path end When(/^...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/spec_helper.rb
Ruby
mit
19
main
3,260
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/i18n_spec.rb
Ruby
mit
19
main
2,102
require "i18n/tasks" require "rails_helper" RSpec.describe "I18n", :i18n do let(:i18n) { I18n::Tasks::BaseTask.new } let(:missing_keys) { i18n.missing_keys[locale] || I18n::Tasks::Data::Tree::Siblings.new } context "with English" do let(:locale) { "en" } it "does not have missing keys" do expect(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/rails_helper.rb
Ruby
mit
19
main
4,841
# This file is copied to spec/ when you run 'rails generate rspec:install' require "spec_helper" ENV["RAILS_ENV"] ||= "test" require File.expand_path("../config/environment", __dir__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system_helper.rb
Ruby
mit
19
main
394
# Idea from https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing # # Load general RSpec Rails configuration require "rails_helper" # Load configuration files and helpers Dir[File.join(__dir__, "system/support/**/*.rb")].each do |file| next if file.match?("spec_helper.rb") requ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/config/initializers/omniauth_spec.rb
Ruby
mit
19
main
1,992
require "rails_helper" RSpec.describe "OmniAuth initializers" do describe "OmniAuth.config.on_failure handler" do subject(:handler) { OmniAuth.config.on_failure } before do env["omniauth.error"] = error env["omniauth.error.type"] = error_type end let(:env) do Rack::MockRequest.env_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/mock_auth/sign_in_reauthentication_spec.rb
Ruby
mit
19
main
4,553
require "system_helper" require Rails.root.join("db/seeds/test_provider_populator") # NOTE: this uses the mocked auth enabled flow (manual login) because use of the mocked OAuth flow # causes transparent reauthentication and therefore forced reauthentication is not testable using it. # In real life the SiLAS authentic...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/mock_auth/sign_in_spec.rb
Ruby
mit
19
main
678
require "system_helper" require Rails.root.join("db/seeds/test_provider_populator") RSpec.describe "The mock entra path works as expected" do feature "When I click the sign in button, from the landing page, I see the select office list" do around do |example| OmniAuth.config.test_mode = true OmniAuth...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/provider/skips_announcement_spec.rb
Ruby
mit
19
main
1,254
require "system_helper" RSpec.describe "A provider can skip announcements" do feature "View the application task list" do before do Announcement.create!(display_type: :moj, body: "New working hours have been implemented 7am to 7pm", start_at: Time.zone.parse("9:00") - 1.day, end_at: Time.zone.parse("9:00")...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/client_details/dwp_flow_spec.rb
Ruby
mit
19
main
6,572
require "system_helper" RSpec.describe "Client and case details section - DWP result flows", :vcr do before do login_as_a_provider visit providers_root_path create_an_application_and_complete_client_details(with_partner?) allow(BenefitCheckService).to receive(:call).with(@legal_aid_application).and_r...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/client_details/benefit_checker_override_spec.rb
Ruby
mit
19
main
7,238
require "system_helper" RSpec.describe "Client and case details section - benefit checker fallback", :vcr do before do login_as_a_provider allow(Setting).to receive_messages(collect_dwp_data?: collect_dwp_data) allow(Setting).to receive_messages(collect_hmrc_data?: collect_hmrc_data) create_an_applic...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/application_task_list/task_list_sections_and_content_spec.rb
Ruby
mit
19
main
5,387
require "system_helper" RSpec.describe "Application task list page sections, subsections and content", :vcr do feature "View the application task list" do before do login_as_a_provider end let(:applicant) do build(:applicant, first_name: "John", last_name: "Doe", ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/application_task_list/client_and_case_details_section/client_details_spec.rb
Ruby
mit
19
main
2,535
require "system_helper" RSpec.describe "Client and case details section - Client details", :vcr do feature "View and amend client details" do before do login_as_a_provider end # TODO: we navigate to the task list directly at time of writing but eventually we should be # navigating using the on...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/application_task_list/client_and_case_details_section/dwp_outcome_spec.rb
Ruby
mit
19
main
2,584
require "system_helper" RSpec.describe "Client and case details section - DWP outcome", :javascript, :vcr do feature "View and amend the DWP outcome section" do before do login_as_a_provider fill_in_client_and_case_details_until_step(:check_your_answers) end scenario "I can complete the task ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/application_task_list/client_and_case_details_section/proceedings_types_spec.rb
Ruby
mit
19
main
6,512
require "system_helper" RSpec.describe "Proceedings types section", :vcr do feature "View the application task list" do before do login_as_a_provider end # TODO: we navigate to the task list directly in this system spec but eventually we should be navigating using the on-screen button # "Save ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/application_task_list/client_and_case_details_section/check_provider_answers_spec.rb
Ruby
mit
19
main
5,218
require "system_helper" RSpec.describe "Client and case details section - Check your answers", :vcr do feature "View check your answers" do before do login_as_a_provider end scenario "I can complete the task list's Check your answers item" do fill_in_client_and_case_details_until_step(:procee...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/screenshot_helpers.rb
Ruby
mit
19
main
873
module ScreenshotHelpers # selenium headless chrome solution for full screenshot def screenshot_and_open_image file_path = screenshot_image Launchy.open file_path end # rubocop:disable Lint/Debugger def screenshot_image(name = "capybara-screenshot") window = Capybara.current_session.driver.browse...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/capybara_helpers.rb
Ruby
mit
19
main
326
module CapybaraHelpers def id_from_current_page_url path = URI.parse(page.current_url).path paths = path.split("/").reject! { |fragment| fragment.to_s.empty? } id_at = paths.find_index("applications") return paths[id_at + 1] if id_at raise "Unable to locate LegalAidApplication ID accurately" en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/spec_helper.rb
Ruby
mit
19
main
1,600
# RSpec system test configuration only. # # For javascript reliant system tests # you can use js: true # e.g. # it "does something dependent on javascript", js: true do # visit "/" # expect(page).to have... # end # # For non-JS dependent tests exclude the js: metadata # e.g. # $ describe "my non-JS dependent test" ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/capybara_setup.rb
Ruby
mit
19
main
1,474
# Selenium logging # https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/#ruby # other args in order of decreasing verbosity\ # :debug, :info, :warn (default), :error, :fatal Selenium::WebDriver.logger.level = :warn # We use a Capybara default value here explicitly. Capybara.default_max_wait_time ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/task_list_helpers.rb
Ruby
mit
19
main
803
module TaskListHelpers def section_list_for(text) heading = page.find("h2.govuk-task-list__section", text:) heading.ancestor("li") end def expect_section_with_task_list_items(section_title, rows = nil) rows ||= yield raise "Invalid row keys for helper #{__method__}" unless rows.flat_map(&:keys)....
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/gouk_form_helpers.rb
Ruby
mit
19
main
723
module GovukFormHelpers def govuk_fill_in_date_field(locator = ".govuk-form-group", text:, date: 21.years.ago) within(locator, text:) do fill_in "Day", with: date.day fill_in "Month", with: date.month fill_in "Year", with: date.year end end def govuk_choose(locator, **) choose(locat...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/step_helpers.rb
Ruby
mit
19
main
2,997
module StepHelpers # Usage specify one of the step names to complete the steps # and leave you on that step's page. # e.g. # fill_in_client_and_case_details_until_step(:has_national_insurance_number) # def fill_in_client_and_case_details_until_step(step_name) visit "/" click_on "Start" govuk_ch...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/support/login_helpers.rb
Ruby
mit
19
main
515
require Rails.root.join("spec/services/pda/provider_details_request_stubs") module LoginHelpers def login_as_a_provider @registered_provider = create(:provider, silas_id: "51cdbbb4-75d2-48d0-aaac-fa67f013c50a") @registered_provider.office_codes = "0X395U:2N078D:A123456" stub_office_schedules_for_0x395u ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/system/providers/end_of_applications_spec.rb
Ruby
mit
19
main
2,049
require "system_helper" RSpec.describe "End of application page" do before do login_as_a_provider visit providers_legal_aid_application_end_of_application_path(application) end context "when application has special children act proceedings" do let(:application) do create(:legal_aid_applicatio...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/builders/applicant_json_builder_spec.rb
Ruby
mit
19
main
706
require "rails_helper" RSpec.describe ApplicantJsonBuilder do describe "#as_json" do subject(:json) { described_class.build(applicant).as_json } let(:applicant) { create(:applicant, relationship_to_children: "foobar") } it "includes relationship_to_involved_children as uppercase version of relationship_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/builders/opponent_json_builder_spec.rb
Ruby
mit
19
main
2,111
require "rails_helper" RSpec.describe OpponentJsonBuilder do subject(:json) { described_class.build(opponent).as_json } let(:opponent) { create(:opponent) } it "includes the expected keys" do expect(json.keys).to include( :id, :legal_aid_application_id, :created_at, :updated_at, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/builders/proceeding_json_builder_spec.rb
Ruby
mit
19
main
7,722
require "rails_helper" RSpec.describe ProceedingJsonBuilder do subject(:json) { described_class.build(proceeding).as_json } let(:proceeding) { create(:proceeding, :special_children_act) } it "includes the expected keys" do expect(json.keys).to include( :id, :legal_aid_application_id, :pro...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/alert_manager_spec.rb
Ruby
mit
19
main
4,747
require "rails_helper" RSpec.describe AlertManager do before { Setting.setting.update(alert_via_sentry: sentry_setting) } let(:sample_sending_environment) { %i[production uat].sample } context "when setting is set to alert via Sentry" do let(:sentry_setting) { true } describe ".capture_exception" do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/slack_alerter_spec.rb
Ruby
mit
19
main
1,643
require "rails_helper" RSpec.describe SlackAlerter do around do |example| ENV["SLACK_ALERT_EMAIL"] = dummy_email_address example.run ENV["SLACK_ALERT_EMAIL"] = nil end before { allow(HostEnv).to receive(:environment).and_return(:uat) } let(:dummy_mail) { instance_double ActionMailer::MessageDeliv...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/authorized_ip_ranges_spec.rb
Ruby
mit
19
main
973
require "rails_helper" RSpec.describe AuthorizedIpRanges do describe "#authorized?" do subject(:authorised) { described_class.new.authorized?(ipaddr) } context "with IPV4" do context "with authorized address" do let(:ipaddr) { "127.0.0.1" } it "is authorised" do expect(autho...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/tasks/digest_spec.rb
Ruby
mit
19
main
2,474
require "rails_helper" RSpec.describe "digest:", type: :task do before do Rails.application.load_tasks if Rake::Task.tasks.empty? allow(HostEnv).to receive(:staging_or_production?).and_return(staging_or_production) allow(Rails.logger).to receive(:info) end let(:staging_or_production) { true } des...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/tasks/migrate_statements_of_case_spec.rb
Ruby
mit
19
main
4,888
require "rails_helper" RSpec.describe "migrate:statements_of_case", type: :task do before do Rails.application.load_tasks if Rake::Task.tasks.empty? Rake::Task["migrate:statements_of_case"].reenable end describe "migrate:statements_of_case" do subject(:task) { Rake::Task["migrate:statements_of_case"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/tasks/provider_transfer/ptr_migrations_spec.rb
Ruby
mit
19
main
9,465
require "rails_helper" RSpec.describe "ptr_migrations:", type: :task do before do Rails.application.load_tasks if Rake::Task.tasks.empty? allow(Rails.logger).to receive(:info) end describe "ptr_migrations:laa_transfer_office" do subject(:task) do Rake::Task["ptr_migrations:laa_transfer_office"...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/task_helpers/ccms_payload_yamlizer_spec.rb
Ruby
mit
19
main
1,203
require "rails_helper" require Rails.root.join("lib/tasks/helpers/ccms_payload_yamlizer") RSpec.describe CcmsPayloadYamlizer do let(:parser) { described_class.new(filename) } let(:filename) { Rails.root.join("ccms_integration/example_payloads/multi_proc/MP_1333536_NP_multi children.xml") } it "parses" do ex...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/omni_auth/hmrc_spec.rb
Ruby
mit
19
main
2,029
require "rails_helper" module OmniAuth module HMRC RSpec.describe Client do subject(:client) { described_class.new } before do stub_request(:post, %r{(http|https).*laa-hmrc-interface.*\.cloud-platform\.service\.justice\.gov\.uk/oauth/token}) .to_return( status: 200, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/omni_auth/strategies/moj_oauth2_spec.rb
Ruby
mit
19
main
3,877
require "rails_helper" require Rails.root.join("app/lib/omni_auth/strategies/moj_oauth2") AccessTokenStruct = Struct.new(:expired?, :token, :expires?) module OmniAuth module Strategies RSpec.describe MojOauth2 do let(:mock_rack_app) { instance_double Rack::Pjax, call: nil } let(:applicant_id) { "50b...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/omni_auth/strategies/true_layer_spec.rb
Ruby
mit
19
main
2,264
require "rails_helper" module OmniAuth module Strategies RSpec.describe TrueLayer do subject(:truelayer_omniauth) { described_class.new({}) } let(:true_layer_root_url) { "https://auth.truelayer.com" } it "has the name true_layer" do expect(truelayer_omniauth.name).to eq(:true_layer) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/lib/prometheus_collectors/sidekiq_queue_collector_spec.rb
Ruby
mit
19
main
859
require "rails_helper" require "prometheus_exporter/server" RSpec.describe PrometheusCollectors::SidekiqQueueCollector do subject(:collector) { described_class.new } let(:queue) { "mailers" } let(:gauge) { instance_spy(PrometheusExporter::Metric::Gauge) } let(:queue_size) { rand(1..100) } before do all...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/application_digests.rb
Ruby
mit
19
main
1,092
FactoryBot.define do factory :application_digest do legal_aid_application_id { SecureRandom.uuid } firm_name { Faker::Company.name } provider_username { Faker::Internet.unique.username } date_started { Faker::Date.backward(days: 90) } date_submitted { date_started + [0, 0, 1, 2, 3, 10, 15, 20].sam...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/admin_reports.rb
Ruby
mit
19
main
406
require "csv" FactoryBot.define do factory :admin_report do trait :with_reports_attached do after :create do |admin_report| csv_string = CSV.generate do |csv| csv << %w[col1 col2 col3] end admin_report.application_details_report.attach io: StringIO.new(csv_string), filenam...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/legal_aid_applications.rb
Ruby
mit
19
main
46,297
FactoryBot.define do factory :legal_aid_application, aliases: [:application] do provider trait :with_applicant do # use :with_bank_accounts: 2 to create 2 bank accounts for the applicant transient do with_bank_accounts { 0 } end applicant { build(:applicant, with_bank_accounts...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/ccms_submissions.rb
Ruby
mit
19
main
2,763
FactoryBot.define do factory :ccms_submission, class: "CCMS::Submission" do legal_aid_application trait :initialised do aasm_state { "initialised" } end trait :lead_application_pending do case_ccms_reference { Faker::Number.number(digits: 12) } aasm_state { "lead_application_pendin...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/regular_transactions.rb
Ruby
mit
19
main
1,265
FactoryBot.define do factory :regular_transaction do legal_aid_application transaction_type amount { 500.00 } frequency { "weekly" } trait :benefits do transaction_type { TransactionType.find_by(name: "benefits") || create(:transaction_type, :benefits) } end trait :maintenance_in d...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/legal_framework_serialized_merits_task_list.rb
Ruby
mit
19
main
16,325
FactoryBot.define do factory :legal_framework_serializable_merits_task_list, class: "LegalFramework::SerializableMeritsTaskList" do initialize_with { new(**lfa_response) } lfa_response do { request_id: SecureRandom.uuid, application: { tasks: { latest_incident_deta...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/permissions.rb
Ruby
mit
19
main
303
FactoryBot.define do factory :permission do sequence(:role) { |n| "role_#{n}" } sequence(:description) { |n| "The description for role_#{n}" } trait :dummy_permission do role { "dummy_permission" } description { "Allow the firm to have a dummy permission" } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/other_assets_declarations.rb
Ruby
mit
19
main
1,980
FactoryBot.define do factory :other_assets_declaration do legal_aid_application trait :with_second_home do second_home_value { rand(1...1_000_000.0).round(2) } second_home_mortgage { rand(1...1_000_000.0).round(2) } second_home_percentage { rand(1...99.0).round(2) } end trait :with...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/benefit_check_results.rb
Ruby
mit
19
main
506
FactoryBot.define do factory :benefit_check_result do legal_aid_application result { "No" } dwp_ref { SecureRandom.hex } trait :positive do result { "Yes" } end trait :negative do result { "No" } end trait :undetermined do result { "Undetermined" } end tra...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/policy_disregards.rb
Ruby
mit
19
main
844
FactoryBot.define do factory :policy_disregards do legal_aid_application england_infected_blood_support { false } vaccine_damage_payments { false } variant_creutzfeldt_jakob_disease { false } criminal_injuries_compensation_scheme { false } national_emergencies_trust { false } we_love_manch...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/cash_transactions.rb
Ruby
mit
19
main
1,239
FactoryBot.define do factory :cash_transaction do legal_aid_application transaction_type amount { Faker::Number.decimal(l_digits: 3, r_digits: 2) } month_number { 1 } trait :credit_month1 do transaction_date { Time.zone.today.at_beginning_of_month - 1.month } month_number { 1 } en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/capital_disregards.rb
Ruby
mit
19
main
267
FactoryBot.define do factory :capital_disregard do legal_aid_application name { "backdated_benefits" } mandatory { true } trait :mandatory do mandatory { true } end trait :discretionary do mandatory { false } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/attachments.rb
Ruby
mit
19
main
2,068
FactoryBot.define do factory :attachment do legal_aid_application attachment_type { "statement_of_case" } attachment_name { "statement_of_case.pdf" } trait :merits_report do attachment_type { "merits_report" } attachment_name { "merits_report.pdf" } end trait :means_report do ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/prohibited_steps.rb
Ruby
mit
19
main
257
FactoryBot.define do factory :prohibited_steps, class: "ProceedingMeritsTask::ProhibitedSteps" do uk_removal { true } proceeding trait :with_data do uk_removal { false } details { "additional data about steps" } end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/vehicles.rb
Ruby
mit
19
main
804
FactoryBot.define do factory :vehicle do legal_aid_application trait :populated do estimated_value { Faker::Commerce.price(range: 2000..10_000) } owner { "client" } payment_remaining { Faker::Commerce.price(range: 100..1_000) } more_than_three_years_old { true } used_regularly {...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/scope_limitations.rb
Ruby
mit
19
main
1,461
FactoryBot.define do factory :scope_limitation do proceeding factory: %i[proceeding da001] trait :emergency do scope_type { 1 } code { "CV117" } meaning { "Interim order inc. return date" } description do 'Limited to Family Help (Higher) and to all steps necessary to negotiate...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
spec/factories/submissions.rb
Ruby
mit
19
main
882
FactoryBot.define do factory :submission, class: "CCMS::Submission" do legal_aid_application { association(:legal_aid_application, merits_submitted_by: create(:provider)) } sequence(:case_ccms_reference) { |n| sprintf("300000%<number>06d", number: n) } trait :case_ref_obtained do aasm_state { "cas...