Browse Source

Fix some intermittent spec failures due to faker data clashes (#742)

* Ensure scheme id and postcode don't class

* Fix case log search intermittent faker bomb
pull/701/head
baarkerlounger 2 years ago committed by GitHub
parent
commit
1a0bacec62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      spec/models/scheme_spec.rb
  2. 2
      spec/requests/case_logs_controller_spec.rb

4
spec/models/scheme_spec.rb

@ -46,6 +46,10 @@ RSpec.describe Scheme, type: :model do
end
context "when searching by all searchable fields" do
before do
location_2.update!(postcode: location_2.postcode.gsub(scheme_1.id.to_s, "0"))
end
it "returns case insensitive matching records" do
expect(described_class.search_by(scheme_1.id.to_s).count).to eq(1)
expect(described_class.search_by(scheme_1.id.to_s).first.id).to eq(scheme_1.id)

2
spec/requests/case_logs_controller_spec.rb

@ -778,7 +778,7 @@ RSpec.describe CaseLogsController, type: :request do
it "dowloads searched logs" do
get "/logs?search=#{case_log.id}", headers:, params: {}
csv = CSV.parse(response.body)
expect(csv.count).to eq(2)
expect(csv.count).to eq(CaseLog.search_by(case_log.id.to_s).count + 1)
end
context "when both filter and search applied" do

Loading…
Cancel
Save