mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 02:22:40 +08:00
DEV: Apply syntax_tree formatting to spec/*
This commit is contained in:
@ -6,28 +6,27 @@ RSpec.describe Middleware::DiscoursePublicExceptions do
|
||||
Rails.logger = @fake_logger = FakeLogger.new
|
||||
end
|
||||
|
||||
after do
|
||||
Rails.logger = @orig_logger
|
||||
end
|
||||
after { Rails.logger = @orig_logger }
|
||||
|
||||
def env(opts = {})
|
||||
{
|
||||
"HTTP_HOST" => "http://test.com",
|
||||
"REQUEST_URI" => "/path?bla=1",
|
||||
"REQUEST_METHOD" => "GET",
|
||||
"rack.input" => ""
|
||||
"rack.input" => "",
|
||||
}.merge(opts)
|
||||
end
|
||||
|
||||
it "should not log for invalid mime type requests" do
|
||||
ex = Middleware::DiscoursePublicExceptions.new("/test")
|
||||
|
||||
ex.call(env(
|
||||
"HTTP_ACCEPT" => "../broken../",
|
||||
"action_dispatch.exception" => ActionController::RoutingError.new("abc")
|
||||
))
|
||||
ex.call(
|
||||
env(
|
||||
"HTTP_ACCEPT" => "../broken../",
|
||||
"action_dispatch.exception" => ActionController::RoutingError.new("abc"),
|
||||
),
|
||||
)
|
||||
|
||||
expect(@fake_logger.warnings.length).to eq(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user