Skip to content

Commit 1405fe0

Browse files
Minor request specs improvements
- reuse an existing record instead of creating duplicate ones - assert that the correct flash notice is displayed when saving an audit
1 parent 43fbcc4 commit 1405fe0

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

spec/requests/audits_requests_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,22 @@
66
{
77
organization_id: organization.id,
88
storage_location_id: storage_location.id,
9-
user_id: create(:organization_admin, organization: organization).id
9+
user_id: organization_admin.id
1010
}
1111
end
1212

1313
let(:invalid_storage_location_attributes) do
1414
{
1515
organization_id: organization.id,
1616
storage_location_id: nil,
17-
user_id: create(:organization_admin, organization: organization).id
17+
user_id: organization_admin.id
1818
}
1919
end
2020

2121
let(:invalid_attributes) do
2222
{ organization_id: nil }
2323
end
2424

25-
let(:valid_session) { {} }
26-
2725
describe "while signed in as an organization admin" do
2826
before do
2927
sign_in(organization_admin)
@@ -155,6 +153,7 @@
155153
expect do
156154
post audits_path(audit: valid_attributes, save_progress: '')
157155
expect(Audit.last.in_progress?).to be_truthy
156+
expect(flash[:notice]).to include("Audit's progress was successfully saved.")
158157
end.to change(Audit.in_progress, :count).by(1)
159158
end
160159

0 commit comments

Comments
 (0)