mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: Move spec/components to spec/lib (#15987)
Lib specs were inexplicably split into two directories (`lib` and `components`) This moves them all into `lib`.
This commit is contained in:
35
spec/lib/middleware/discourse_public_exceptions_spec.rb
Normal file
35
spec/lib/middleware/discourse_public_exceptions_spec.rb
Normal file
@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
describe Middleware::DiscoursePublicExceptions do
|
||||
before do
|
||||
@orig_logger = Rails.logger
|
||||
Rails.logger = @fake_logger = FakeLogger.new
|
||||
end
|
||||
|
||||
after do
|
||||
Rails.logger = @orig_logger
|
||||
end
|
||||
|
||||
def env(opts = {})
|
||||
{
|
||||
"HTTP_HOST" => "http://test.com",
|
||||
"REQUEST_URI" => "/path?bla=1",
|
||||
"REQUEST_METHOD" => "GET",
|
||||
"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")
|
||||
))
|
||||
|
||||
expect(@fake_logger.warnings.length).to eq(0)
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user