Skip to content

Commit 398db5c

Browse files
author
Drew Proebstel
committed
update annotate
1 parent 1a8bf33 commit 398db5c

File tree

1 file changed

+172
-172
lines changed

1 file changed

+172
-172
lines changed
Lines changed: 172 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,172 @@
1-
# # == Schema Information
2-
# #
3-
# # Table name: state_file_archived_intake_requests
4-
# #
5-
# # id :bigint not null, primary key
6-
# # email_address :string
7-
# # failed_attempts :integer default(0), not null
8-
# # fake_address_1 :string
9-
# # fake_address_2 :string
10-
# # ip_address :string
11-
# # locked_at :datetime
12-
# # created_at :datetime not null
13-
# # updated_at :datetime not null
14-
# # state_file_archived_intake_id :bigint
15-
# #
16-
# # Indexes
17-
# #
18-
# # idx_on_state_file_archived_intake_id_7dd0f99380 (state_file_archived_intake_id)
19-
# #
20-
# require "rails_helper"
21-
#
22-
# describe StateFileArchivedIntakeRequest do
23-
# describe "#increment_failed_attempts" do
24-
# let!(:request_instance) { create :state_file_archived_intake_request, failed_attempts: 1 }
25-
# it "locks access when failed attempts is incremented to 2" do
26-
# expect(request_instance.access_locked?).to eq(false)
27-
#
28-
# request_instance.increment_failed_attempts
29-
#
30-
# expect(request_instance.access_locked?).to eq(true)
31-
# end
32-
# end
33-
#
34-
# describe "#s3_credentials" do
35-
# context "AWS_ACCESS_KEY_ID in ENV" do
36-
# it "uses the environment variables" do
37-
# stub_const("ENV", {
38-
# "AWS_ACCESS_KEY_ID" => "mock-aws-access-key-id",
39-
# "AWS_SECRET_ACCESS_KEY" => "mock-aws-secret-access-key"
40-
# })
41-
# credentials = SchemaFileLoader.s3_credentials
42-
# expect(credentials.access_key_id).to eq "mock-aws-access-key-id"
43-
# end
44-
# end
45-
#
46-
# context "without AWS_ACCESS_KEY_ID in ENV" do
47-
# it "uses the rails credentials" do
48-
# stub_const("ENV", {})
49-
# expect(Rails.application.credentials).to receive(:dig).with(:aws, :access_key_id).and_return "mock-aws-access-key-id"
50-
# expect(Rails.application.credentials).to receive(:dig).with(:aws, :secret_access_key).and_return "mock-aws-secret-access-key"
51-
# credentials = SchemaFileLoader.s3_credentials
52-
# expect(credentials.access_key_id).to eq "mock-aws-access-key-id"
53-
# end
54-
# end
55-
# end
56-
#
57-
# describe "#fetch_random_addresses" do
58-
# let(:state_file_archived_intake) { create(:state_file_archived_intake, mailing_state: "NY") }
59-
# let(:state_file_archived_intake_request) { create(:state_file_archived_intake_request, state_file_archived_intake: state_file_archived_intake) }
60-
#
61-
# before do
62-
# allow(Aws::S3::Client).to receive(:new).and_return(
63-
# double("Aws::S3::Client", get_object: true)
64-
# )
65-
# allow(CSV).to receive(:read).and_return(["123 Fake St", "456 Imaginary Rd"])
66-
# end
67-
#
68-
# context "when in production environment" do
69-
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production")) }
70-
# context "when state_file_archived_intake has different mailing states" do
71-
# it "uses the correct file key and for AZ" do
72-
# state_file_archived_intake.update!(mailing_state: "AZ")
73-
# state_file_archived_intake_request.update!(state_file_archived_intake: state_file_archived_intake)
74-
#
75-
# allow(state_file_archived_intake_request).to receive(:download_file_from_s3).and_call_original
76-
#
77-
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
78-
# "vita-min-prod-docs",
79-
# "az_addresses.csv",
80-
# Rails.root.join("tmp", "az_addresses.csv").to_s
81-
# )
82-
#
83-
# state_file_archived_intake_request.send(:fetch_random_addresses)
84-
# end
85-
#
86-
# it "uses the correct file key and bucket for NY" do
87-
# state_file_archived_intake.update!(mailing_state: "NY")
88-
# state_file_archived_intake_request.update!(state_file_archived_intake: state_file_archived_intake)
89-
#
90-
# allow(state_file_archived_intake_request).to receive(:download_file_from_s3).and_call_original
91-
#
92-
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
93-
# "vita-min-prod-docs",
94-
# "ny_addresses.csv",
95-
# Rails.root.join("tmp", "ny_addresses.csv").to_s
96-
# )
97-
#
98-
# state_file_archived_intake_request.send(:fetch_random_addresses)
99-
# end
100-
# end
101-
# end
102-
#
103-
# context "when in staging environment" do
104-
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("staging")) }
105-
#
106-
# it "uses the correct bucket and file key" do
107-
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
108-
# "vita-min-staging-docs",
109-
# "non_prod_addresses.csv",
110-
# Rails.root.join("tmp", "non_prod_addresses.csv").to_s
111-
# )
112-
#
113-
# state_file_archived_intake_request.send(:fetch_random_addresses)
114-
# end
115-
# end
116-
#
117-
# context "when in development environment" do
118-
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("development")) }
119-
#
120-
# it "uses the correct local file path" do
121-
# expect(CSV).to receive(:read).with(
122-
# Rails.root.join("app", "lib", "challenge_addresses", "test_addresses.csv"),
123-
# headers: false
124-
# ).and_return(["123 Fake St", "456 Imaginary Rd"])
125-
#
126-
# state_file_archived_intake_request.send(:fetch_random_addresses)
127-
# end
128-
# end
129-
#
130-
# context "when in test environment" do
131-
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("test")) }
132-
#
133-
# it "uses the correct local file path" do
134-
# expect(CSV).to receive(:read).with(
135-
# Rails.root.join("app", "lib", "challenge_addresses", "test_addresses.csv"),
136-
# headers: false
137-
# )
138-
#
139-
# state_file_archived_intake_request.send(:fetch_random_addresses)
140-
# end
141-
# end
142-
#
143-
# context "when in demo environment" do
144-
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("demo")) }
145-
#
146-
# it "uses the correct bucket and file key" do
147-
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
148-
# "vita-min-demo-docs",
149-
# "non_prod_addresses.csv",
150-
# Rails.root.join("tmp", "non_prod_addresses.csv").to_s
151-
# )
152-
#
153-
# state_file_archived_intake_request.send(:fetch_random_addresses)
154-
# end
155-
# end
156-
# end
157-
#
158-
# describe "#populate_fake_addresses" do
159-
# let(:state_file_archived_intake_request) { build(:state_file_archived_intake_request, fake_address_1: nil, fake_address_2: nil) }
160-
#
161-
# context "when state_file_archived_intake is not present" do
162-
# before { allow(state_file_archived_intake_request).to receive(:state_file_archived_intake).and_return(nil) }
163-
#
164-
# it "does not populate fake_address_1 and fake_address_2" do
165-
# state_file_archived_intake_request.save
166-
#
167-
# expect(state_file_archived_intake_request.fake_address_1).to be_nil
168-
# expect(state_file_archived_intake_request.fake_address_2).to be_nil
169-
# end
170-
# end
171-
# end
172-
# end
1+
# == Schema Information
2+
#
3+
# Table name: state_file_archived_intake_requests
4+
#
5+
# id :bigint not null, primary key
6+
# email_address :string
7+
# failed_attempts :integer default(0), not null
8+
# fake_address_1 :string
9+
# fake_address_2 :string
10+
# ip_address :string
11+
# locked_at :datetime
12+
# created_at :datetime not null
13+
# updated_at :datetime not null
14+
# state_file_archived_intake_id :bigint
15+
#
16+
# Indexes
17+
#
18+
# idx_on_state_file_archived_intake_id_7dd0f99380 (state_file_archived_intake_id)
19+
#
20+
require "rails_helper"
21+
22+
describe StateFileArchivedIntakeRequest do
23+
# describe "#increment_failed_attempts" do
24+
# let!(:request_instance) { create :state_file_archived_intake_request, failed_attempts: 1 }
25+
# it "locks access when failed attempts is incremented to 2" do
26+
# expect(request_instance.access_locked?).to eq(false)
27+
#
28+
# request_instance.increment_failed_attempts
29+
#
30+
# expect(request_instance.access_locked?).to eq(true)
31+
# end
32+
# end
33+
#
34+
# describe "#s3_credentials" do
35+
# context "AWS_ACCESS_KEY_ID in ENV" do
36+
# it "uses the environment variables" do
37+
# stub_const("ENV", {
38+
# "AWS_ACCESS_KEY_ID" => "mock-aws-access-key-id",
39+
# "AWS_SECRET_ACCESS_KEY" => "mock-aws-secret-access-key"
40+
# })
41+
# credentials = SchemaFileLoader.s3_credentials
42+
# expect(credentials.access_key_id).to eq "mock-aws-access-key-id"
43+
# end
44+
# end
45+
#
46+
# context "without AWS_ACCESS_KEY_ID in ENV" do
47+
# it "uses the rails credentials" do
48+
# stub_const("ENV", {})
49+
# expect(Rails.application.credentials).to receive(:dig).with(:aws, :access_key_id).and_return "mock-aws-access-key-id"
50+
# expect(Rails.application.credentials).to receive(:dig).with(:aws, :secret_access_key).and_return "mock-aws-secret-access-key"
51+
# credentials = SchemaFileLoader.s3_credentials
52+
# expect(credentials.access_key_id).to eq "mock-aws-access-key-id"
53+
# end
54+
# end
55+
# end
56+
#
57+
# describe "#fetch_random_addresses" do
58+
# let(:state_file_archived_intake) { create(:state_file_archived_intake, mailing_state: "NY") }
59+
# let(:state_file_archived_intake_request) { create(:state_file_archived_intake_request, state_file_archived_intake: state_file_archived_intake) }
60+
#
61+
# before do
62+
# allow(Aws::S3::Client).to receive(:new).and_return(
63+
# double("Aws::S3::Client", get_object: true)
64+
# )
65+
# allow(CSV).to receive(:read).and_return(["123 Fake St", "456 Imaginary Rd"])
66+
# end
67+
#
68+
# context "when in production environment" do
69+
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production")) }
70+
# context "when state_file_archived_intake has different mailing states" do
71+
# it "uses the correct file key and for AZ" do
72+
# state_file_archived_intake.update!(mailing_state: "AZ")
73+
# state_file_archived_intake_request.update!(state_file_archived_intake: state_file_archived_intake)
74+
#
75+
# allow(state_file_archived_intake_request).to receive(:download_file_from_s3).and_call_original
76+
#
77+
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
78+
# "vita-min-prod-docs",
79+
# "az_addresses.csv",
80+
# Rails.root.join("tmp", "az_addresses.csv").to_s
81+
# )
82+
#
83+
# state_file_archived_intake_request.send(:fetch_random_addresses)
84+
# end
85+
#
86+
# it "uses the correct file key and bucket for NY" do
87+
# state_file_archived_intake.update!(mailing_state: "NY")
88+
# state_file_archived_intake_request.update!(state_file_archived_intake: state_file_archived_intake)
89+
#
90+
# allow(state_file_archived_intake_request).to receive(:download_file_from_s3).and_call_original
91+
#
92+
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
93+
# "vita-min-prod-docs",
94+
# "ny_addresses.csv",
95+
# Rails.root.join("tmp", "ny_addresses.csv").to_s
96+
# )
97+
#
98+
# state_file_archived_intake_request.send(:fetch_random_addresses)
99+
# end
100+
# end
101+
# end
102+
#
103+
# context "when in staging environment" do
104+
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("staging")) }
105+
#
106+
# it "uses the correct bucket and file key" do
107+
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
108+
# "vita-min-staging-docs",
109+
# "non_prod_addresses.csv",
110+
# Rails.root.join("tmp", "non_prod_addresses.csv").to_s
111+
# )
112+
#
113+
# state_file_archived_intake_request.send(:fetch_random_addresses)
114+
# end
115+
# end
116+
#
117+
# context "when in development environment" do
118+
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("development")) }
119+
#
120+
# it "uses the correct local file path" do
121+
# expect(CSV).to receive(:read).with(
122+
# Rails.root.join("app", "lib", "challenge_addresses", "test_addresses.csv"),
123+
# headers: false
124+
# ).and_return(["123 Fake St", "456 Imaginary Rd"])
125+
#
126+
# state_file_archived_intake_request.send(:fetch_random_addresses)
127+
# end
128+
# end
129+
#
130+
# context "when in test environment" do
131+
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("test")) }
132+
#
133+
# it "uses the correct local file path" do
134+
# expect(CSV).to receive(:read).with(
135+
# Rails.root.join("app", "lib", "challenge_addresses", "test_addresses.csv"),
136+
# headers: false
137+
# )
138+
#
139+
# state_file_archived_intake_request.send(:fetch_random_addresses)
140+
# end
141+
# end
142+
#
143+
# context "when in demo environment" do
144+
# before { allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("demo")) }
145+
#
146+
# it "uses the correct bucket and file key" do
147+
# expect(state_file_archived_intake_request).to receive(:download_file_from_s3).with(
148+
# "vita-min-demo-docs",
149+
# "non_prod_addresses.csv",
150+
# Rails.root.join("tmp", "non_prod_addresses.csv").to_s
151+
# )
152+
#
153+
# state_file_archived_intake_request.send(:fetch_random_addresses)
154+
# end
155+
# end
156+
# end
157+
#
158+
# describe "#populate_fake_addresses" do
159+
# let(:state_file_archived_intake_request) { build(:state_file_archived_intake_request, fake_address_1: nil, fake_address_2: nil) }
160+
#
161+
# context "when state_file_archived_intake is not present" do
162+
# before { allow(state_file_archived_intake_request).to receive(:state_file_archived_intake).and_return(nil) }
163+
#
164+
# it "does not populate fake_address_1 and fake_address_2" do
165+
# state_file_archived_intake_request.save
166+
#
167+
# expect(state_file_archived_intake_request.fake_address_1).to be_nil
168+
# expect(state_file_archived_intake_request.fake_address_2).to be_nil
169+
# end
170+
# end
171+
# end
172+
end

0 commit comments

Comments
 (0)