DEV: Apply syntax_tree formatting to spec/*

This commit is contained in:
David Taylor
2023-01-09 11:18:21 +00:00
parent 0cf6421716
commit cb932d6ee1
907 changed files with 58693 additions and 45909 deletions

View File

@@ -1,27 +1,31 @@
# frozen_string_literal: true
RSpec.describe 'invalid requests', type: :request do
RSpec.describe "invalid requests", type: :request do
before do
@orig_logger = Rails.logger
Rails.logger = @fake_logger = FakeLogger.new
end
after do
Rails.logger = @orig_logger
end
after { Rails.logger = @orig_logger }
it "handles NotFound with invalid json body" do
post "/latest.json", params: "{some: malformed: json", headers: { "content-type" => "application/json" }
post "/latest.json",
params: "{some: malformed: json",
headers: {
"content-type" => "application/json",
}
expect(response.status).to eq(404)
expect(@fake_logger.warnings.length).to eq(0)
expect(@fake_logger.errors.length).to eq(0)
end
it "handles EOFError when multipart request is malformed" do
post "/latest.json", params: "somecontent", headers: {
"content-type" => "multipart/form-data; boundary=abcde",
"content-length" => "1"
}
post "/latest.json",
params: "somecontent",
headers: {
"content-type" => "multipart/form-data; boundary=abcde",
"content-length" => "1",
}
expect(response.status).to eq(400)
expect(@fake_logger.warnings.length).to eq(0)
expect(@fake_logger.errors.length).to eq(0)
@@ -33,5 +37,4 @@ RSpec.describe 'invalid requests', type: :request do
expect(@fake_logger.warnings.length).to eq(0)
expect(@fake_logger.errors.length).to eq(0)
end
end