|
|
@ -765,16 +765,14 @@ RSpec.describe CaseLogsController, type: :request do |
|
|
|
|
|
|
|
|
|
|
|
context "when both filter and search applied" do |
|
|
|
context "when both filter and search applied" do |
|
|
|
let(:postcode) { "XX1 1TG" } |
|
|
|
let(:postcode) { "XX1 1TG" } |
|
|
|
let!(:case_log) do |
|
|
|
|
|
|
|
FactoryBot.create(:case_log, :completed, postcode_full: postcode, owning_organisation: organisation) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
FactoryBot.create(:case_log, :in_progress, postcode_full: postcode, owning_organisation: organisation) |
|
|
|
FactoryBot.create(:case_log, :in_progress, postcode_full: postcode, owning_organisation: organisation) |
|
|
|
|
|
|
|
FactoryBot.create(:case_log, :completed, postcode_full: postcode, owning_organisation: organisation) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "dowloads logs matching both csv and filter logs" do |
|
|
|
it "dowloads logs matching both csv and filter logs" do |
|
|
|
get "/logs?status[]=completed&search=#{case_log.postcode_full}", headers:, params: {} |
|
|
|
get "/logs?status[]=completed&search=#{postcode}", headers:, params: {} |
|
|
|
csv = CSV.parse(response.body) |
|
|
|
csv = CSV.parse(response.body) |
|
|
|
expect(csv.count).to eq(2) |
|
|
|
expect(csv.count).to eq(2) |
|
|
|
end |
|
|
|
end |
|
|
|