Skip to content

Commit

Permalink
Update to simplify factory spec creation (#228)
Browse files Browse the repository at this point in the history
* Update to simplify factory spec creation

* Update pinwheel_controller_spec.rb
  • Loading branch information
acouch authored Aug 26, 2024
1 parent 63919d5 commit 1755bab
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/spec/controllers/api/pinwheel_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
include PinwheelApiHelper

context "#create_token" do
let(:cbv_flow) { create(:cbv_flow, case_number: "TEST123", site_id: "sandbox") }
let(:cbv_flow) { create(:cbv_flow) }
let(:valid_params) do
{
pinwheel: { response_type: "employer", id: "123" }
Expand Down
2 changes: 1 addition & 1 deletion app/spec/controllers/cbv/add_jobs_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"

RSpec.describe Cbv::AddJobsController do
let(:cbv_flow) { create(:cbv_flow, case_number: "ABC1234", site_id: "sandbox") }
let(:cbv_flow) { create(:cbv_flow) }

before do
session[:cbv_flow_id] = cbv_flow.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
include PinwheelApiHelper

describe "#show" do
let(:cbv_flow) { create(:cbv_flow, case_number: "ABC1234", site_id: "sandbox") }
let(:cbv_flow) { create(:cbv_flow) }
let(:nyc_user) { create(:user, email: "[email protected]", site_id: 'nyc') }
let(:pinwheel_token_id) { "abc-def-ghi" }
let(:user_token) { "foobar" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
end

describe "#update" do
let!(:cbv_flow) { create(:cbv_flow, case_number: "ABC1234", pinwheel_token_id: "abc-def-ghi", site_id: "sandbox") }
let!(:cbv_flow) { create(:cbv_flow) }
let(:account_id) { SecureRandom.uuid }
let(:comment) { "This is a test comment" }

Expand Down
2 changes: 1 addition & 1 deletion app/spec/controllers/cbv/successes_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
include PinwheelApiHelper

describe "#show" do
let(:cbv_flow) { create(:cbv_flow, case_number: "ABC1234", site_id: "sandbox", confirmation_code: "NYC12345") }
let(:cbv_flow) { create(:cbv_flow, confirmation_code: "NYC12345") }

before do
stub_request_end_user_paystubs_response
Expand Down
2 changes: 1 addition & 1 deletion app/spec/mailers/caseworker_mailer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"

RSpec.describe CaseworkerMailer, type: :mailer do
let(:cbv_flow) { create(:cbv_flow, :with_pinwheel_account, case_number: "ABC1234") }
let(:cbv_flow) { create(:cbv_flow, :with_pinwheel_account) }
let(:account_id) { cbv_flow.pinwheel_accounts.first.pinwheel_account_id }
let(:payments) { stub_post_processed_payments(account_id) }
let(:employments) { stub_employments(account_id) }
Expand Down
20 changes: 3 additions & 17 deletions app/spec/services/data_retention_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
require "rails_helper"

RSpec.describe DataRetentionService do
let(:cbv_flow_props) do
{
first_name: "John",
middle_name: "Doe",
last_name: "Smith",
case_number: "ABC1234",
email_address: "[email protected]",
agency_id_number: "A12345",
site_id: "sandbox",
snap_application_date: Date.today,
created_at: Time.new(2024, 8, 1, 12, 0, 0, "-04:00")
}
end

describe "#redact_invitations" do
let!(:cbv_flow_invitation) do
create(:cbv_flow_invitation, cbv_flow_props)
create(:cbv_flow_invitation)
end
let(:service) { DataRetentionService.new }
let(:now) { Time.now }
Expand Down Expand Up @@ -54,7 +40,7 @@

describe "#redact_incomplete_cbv_flows" do
let!(:cbv_flow_invitation) do
create(:cbv_flow_invitation, cbv_flow_props)
create(:cbv_flow_invitation)
end
let!(:cbv_flow) { CbvFlow.create_from_invitation(cbv_flow_invitation) }
let(:service) { DataRetentionService.new }
Expand Down Expand Up @@ -115,7 +101,7 @@

describe "#redact_complete_cbv_flows" do
let!(:cbv_flow_invitation) do
CbvFlowInvitation.create!(cbv_flow_props)
create(:cbv_flow_invitation)
end
let!(:cbv_flow) do
CbvFlow
Expand Down

0 comments on commit 1755bab

Please sign in to comment.