Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,10 @@ Style/BeginBlock:
Style/BlockComments:
Enabled: true

Style/BlockDelimiters:
Enabled: true
EnforcedStyle: line_count_based

Style/CharacterLiteral:
Enabled: true

Expand Down
4 changes: 2 additions & 2 deletions scripts/changelog_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def get_git_log(base_branch, source_branch)
# The string is first split on DELIMITER, and then the body is split into
# individual lines.
def build_structured_git_log(git_log)
git_log.strip.split('DELIMITER').map { |commit|
git_log.strip.split('DELIMITER').map do |commit|
commit.split("\nbody:").map do |commit_message_lines|
commit_message_lines.split(%r{[\r\n]}).filter { |line| line != '' }
end
}.map do |title_and_commit_messages|
end.map do |title_and_commit_messages|
title = title_and_commit_messages.first.first.delete_prefix('title: ')
messages = title_and_commit_messages[1]
SquashedCommit.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
let(:user) { create(:user, :signed_up) }
let(:flow_path) { 'standard' }
let(:liveness_checking_enabled) { false }
let(:analytics_data) {
let(:analytics_data) do
{ browser_attributes:
{ browser_bot: false,
browser_device_name: 'Unknown',
Expand All @@ -34,7 +34,7 @@
browser_platform_version: '0',
browser_version: '0.0',
user_agent: 'Rails Testing' } }
}
end

before do
stub_sign_in(user) if user
Expand Down
12 changes: 6 additions & 6 deletions spec/controllers/api/verify/password_confirm_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def stub_idv_session
end

context 'with in-person profile' do
let(:applicant) {
let(:applicant) do
Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE.merge(same_address_as_id: true)
}
end
let(:stub_idv_session) do
stub_user_with_applicant_data(user, applicant)
end
Expand Down Expand Up @@ -268,9 +268,9 @@ def stub_idv_session
end

context 'with threatmetrix required but review status did not pass' do
let(:applicant) {
let(:applicant) do
Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE.merge(same_address_as_id: true)
}
end
let(:stub_idv_session) do
stub_user_with_applicant_data(user, applicant)
end
Expand Down Expand Up @@ -326,9 +326,9 @@ def stub_idv_session
end

context 'with in person profile' do
let(:applicant) {
let(:applicant) do
Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE.merge(same_address_as_id: true)
}
end
let(:stub_idv_session) do
stub_user_with_applicant_data(user, applicant)
end
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/idv/gpo_verify_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
let(:success) { true }
let(:otp) { 'ABC123' }
let(:submitted_otp) { otp }
let(:pending_profile) {
let(:pending_profile) do
create(
:profile,
:with_pii,
user: user,
proofing_components: proofing_components,
)
}
end
let(:proofing_components) { nil }
let(:user) { create(:user) }

Expand Down Expand Up @@ -124,9 +124,9 @@
end

context 'with establishing in person enrollment' do
let(:proofing_components) {
let(:proofing_components) do
ProofingComponent.create(user: user, document_check: Idp::Constants::Vendors::USPS)
}
end

before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@

describe '#index' do
let(:proofer) { double('Proofer') }
let(:locations) {
let(:locations) do
[
{ name: 'Location 1' },
{ name: 'Location 2' },
{ name: 'Location 3' },
{ name: 'Location 4' },
]
}
end
subject(:response) { get :index }

before do
Expand Down
16 changes: 8 additions & 8 deletions spec/controllers/idv/review_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def show
end

describe '#confirm_current_password' do
let(:applicant) {
let(:applicant) do
Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE.merge(phone_confirmed_at: Time.zone.now)
}
end

controller do
before_action :confirm_current_password
Expand Down Expand Up @@ -284,9 +284,9 @@ def show
end

context 'user fails to supply correct password' do
let(:applicant) {
let(:applicant) do
Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE.merge(phone_confirmed_at: Time.zone.now)
}
end

before do
idv_session
Expand Down Expand Up @@ -378,17 +378,17 @@ def show
end

context 'with in person profile' do
let!(:enrollment) {
let!(:enrollment) do
create(:in_person_enrollment, :establishing, user: user, profile: nil)
}
end
let(:stub_usps_response) do
stub_request_enroll
end
let(:applicant) {
let(:applicant) do
Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE.merge(
same_address_as_id: true,
)
}
end

before do
stub_request_token
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/users/verify_personal_key_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
end

describe '#create' do
let!(:profiles) {
let!(:profiles) do
[
create(
:profile,
Expand All @@ -79,7 +79,7 @@
pii: { ssn: '123456789' },
),
]
}
end
let(:error_text) { 'Incorrect personal key' }
let(:personal_key_error) { { personal_key: [error_text] } }
let(:response_ok) { FormResponse.new(success: true, errors: {}) }
Expand Down
8 changes: 4 additions & 4 deletions spec/features/saml/ial1/account_creation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

expect(current_url).to eq sign_up_cancel_url

expect {
expect do
click_button t('forms.buttons.cancel')
}.to change(User, :count).by(-1)
end.to change(User, :count).by(-1)
expect(current_url).to eq \
new_user_session_url(request_id: ServiceProviderRequestProxy.last.uuid)
end
Expand All @@ -40,9 +40,9 @@
click_link t('links.cancel_account_creation')

expect(current_url).to eq sign_up_cancel_url
expect {
expect do
click_link t('links.go_back')
}.to change(User, :count).by(0)
end.to change(User, :count).by(0)

expect(current_url).to eq previous_url
end
Expand Down
8 changes: 4 additions & 4 deletions spec/forms/gpo_verify_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
let(:entered_otp) { otp }
let(:otp) { 'ABC123' }
let(:code_sent_at) { Time.zone.now }
let(:pending_profile) {
let(:pending_profile) do
create(
:profile,
user: user,
deactivation_reason: :gpo_verification_pending,
proofing_components: proofing_components,
)
}
end
let(:proofing_components) { nil }

before do
Expand Down Expand Up @@ -122,9 +122,9 @@
let!(:enrollment) do
create(:in_person_enrollment, :establishing, profile: pending_profile, user: user)
end
let(:proofing_components) {
let(:proofing_components) do
ProofingComponent.create(user: user, document_check: Idp::Constants::Vendors::USPS)
}
end
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/forms/two_factor_options_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
let(:user) { build(:user) }
let(:aal3_required) { false }
let(:piv_cac_required) { false }
subject {
subject do
described_class.new(
user: user,
aal3_required: aal3_required,
piv_cac_required: piv_cac_required,
)
}
end

describe '#submit' do
let(:submit_phone) { subject.submit(selection: 'phone') }
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/identity_job_log_subscriber_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
expect(json['exception_message']).to eq 'invalid base64'
end

expect {
expect do
AddressProofingJob.perform_later(
result_id: nil,
encrypted_arguments: 'abc',
trace_id: nil,
user_id: SecureRandom.random_number(1000),
issuer: build(:service_provider).issuer,
)
}.to raise_error(ArgumentError)
end.to raise_error(ArgumentError)
end

describe '#enqueue_retry' do
Expand Down
16 changes: 8 additions & 8 deletions spec/lib/session_encryptor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@
},
}

expect {
expect do
subject.dump(session)
}.to raise_error(
end.to raise_error(
RuntimeError, "invalid session, 'sensitive_data' is reserved key"
)
end
Expand All @@ -138,15 +138,15 @@
'idv_new' => [{ 'nested' => { 'ssn' => '666-66-6666' } }],
} }

expect {
expect do
subject.dump(nested_session)
}.to raise_error(
end.to raise_error(
SessionEncryptor::SensitiveKeyError, 'ssn unexpectedly appeared in session'
)

expect {
expect do
subject.dump(nested_array_session)
}.to raise_error(
end.to raise_error(
SessionEncryptor::SensitiveKeyError, 'ssn unexpectedly appeared in session'
)
end
Expand Down Expand Up @@ -174,9 +174,9 @@
'new_key' => Idp::Constants::MOCK_IDV_APPLICANT[:last_name],
}

expect {
expect do
subject.dump(session)
}.to raise_error(
end.to raise_error(
SessionEncryptor::SensitiveValueError,
)
end
Expand Down
12 changes: 6 additions & 6 deletions spec/mailers/user_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,14 @@ def expect_email_body_to_have_help_and_contact_links

describe '#in_person_ready_to_verify' do
let(:first_name) { 'Michael' }
let!(:enrollment) {
let!(:enrollment) do
create(
:in_person_enrollment,
:pending,
selected_location_details: { name: 'FRIENDSHIP' },
status_updated_at: Time.zone.now - 2.hours,
)
}
end

let(:mail) do
UserMailer.in_person_ready_to_verify(
Expand All @@ -545,13 +545,13 @@ def expect_email_body_to_have_help_and_contact_links
end

describe '#in_person_verified' do
let(:enrollment) {
let(:enrollment) do
create(
:in_person_enrollment,
selected_location_details: { name: 'FRIENDSHIP' },
status_updated_at: Time.zone.now - 2.hours,
)
}
end

let(:mail) do
UserMailer.in_person_verified(
Expand All @@ -566,13 +566,13 @@ def expect_email_body_to_have_help_and_contact_links
end

describe '#in_person_failed' do
let(:enrollment) {
let(:enrollment) do
create(
:in_person_enrollment,
selected_location_details: { name: 'FRIENDSHIP' },
status_updated_at: Time.zone.now - 2.hours,
)
}
end

let(:mail) do
UserMailer.in_person_failed(
Expand Down
8 changes: 4 additions & 4 deletions spec/models/in_person_enrollment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

it 'does not constrain enrollments for non-pending status' do
user = create(:user)
expect {
expect do
InPersonEnrollment.statuses.each do |key,|
status = InPersonEnrollment.statuses[key]
profile = create(:profile, :gpo_verification_pending, user: user)
Expand All @@ -59,7 +59,7 @@
create(:in_person_enrollment, user: user, profile: profile, status: status)
end
end
}.not_to raise_error
end.not_to raise_error
expect(InPersonEnrollment.pending.count).to eq 1
expect(InPersonEnrollment.count).to eq(InPersonEnrollment.statuses.length * 2 - 1)
expect(InPersonEnrollment.pending.first.status_updated_at).to_not be_nil
Expand All @@ -71,9 +71,9 @@
let!(:passed_enrollment) { create(:in_person_enrollment, :passed) }
let!(:failing_enrollment) { create(:in_person_enrollment, :failed) }
let!(:expired_enrollment) { create(:in_person_enrollment, :expired) }
let!(:checked_pending_enrollment) {
let!(:checked_pending_enrollment) do
create(:in_person_enrollment, :pending, status_check_attempted_at: Time.zone.now)
}
end
let!(:needy_enrollments) do
[
create(:in_person_enrollment, :pending),
Expand Down
Loading