mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Set the application logger using configuration
This commit is contained in:
parent
d3af622586
commit
57e298fcd5
1 changed files with 5 additions and 3 deletions
|
@ -11,10 +11,12 @@ module ApplicationTests
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
build_app
|
build_app
|
||||||
|
add_to_config <<-RUBY
|
||||||
|
config.logger = ActiveSupport::LogSubscriber::TestHelper::MockLogger.new
|
||||||
|
RUBY
|
||||||
|
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
super
|
super
|
||||||
@logger = MockLogger.new
|
|
||||||
Rails.stubs(:logger).returns(@logger)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
@ -23,7 +25,7 @@ module ApplicationTests
|
||||||
end
|
end
|
||||||
|
|
||||||
def logs
|
def logs
|
||||||
@logs ||= @logger.logged(:info).join("\n")
|
@logs ||= Rails.logger.logged(:info).join("\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "logger logs proper HTTP GET verb and path" do
|
test "logger logs proper HTTP GET verb and path" do
|
||||||
|
|
Loading…
Reference in a new issue