test/unit/logging_tests.rb in deas-0.43.3 vs test/unit/logging_tests.rb in deas-0.43.4
- old
+ new
@@ -5,25 +5,23 @@
class UnitTests < Assert::Context
desc "Deas::Logging"
subject{ Deas::Logging }
- should have_imeths :middleware_args
+ should have_imeths :middleware_type
should "return middleware args given a verbose flag" do
- assert_equal [Deas::VerboseLogging], subject.middleware_args(true)
- assert_equal [Deas::SummaryLogging], subject.middleware_args(false)
+ assert_equal Deas::VerboseLogging, subject.middleware_type(true)
+ assert_equal Deas::SummaryLogging, subject.middleware_type(false)
end
end
class CallSetupTests < UnitTests
setup do
@logger = SpyLogger.new
- @app = Factory.sinatra_call({
- :deas_server_data => Factory.server_data(:logger => @logger)
- })
+ @app = Factory.sinatra_call
@app_call_env = nil
@resp_status = Factory.integer
@resp_headers = { 'Location' => Factory.path }
@app_response = [@resp_status, @resp_headers, [Factory.text]]
@@ -58,11 +56,11 @@
Assert.stub(Benchmark, :measure) do |&block|
block.call
@benchmark
end
- @middleware = @middleware_class.new(@app)
+ @middleware = @middleware_class.new(@app, @logger)
end
subject{ @middleware }
should have_imeths :call, :call!
@@ -129,11 +127,11 @@
desc "when init"
setup do
@resp_status = @middleware_class::RESPONSE_STATUS_NAMES.keys.sample
@app_response[0] = @resp_status
- @middleware = Deas::VerboseLogging.new(@app)
+ @middleware = Deas::VerboseLogging.new(@app, @logger)
end
subject{ @middleware }
should have_imeths :call!
@@ -211,10 +209,10 @@
'deas.params' => @params,
'deas.splat' => @splat,
'deas.handler_class' => @handler_class
})
- @middleware = Deas::SummaryLogging.new(@app)
+ @middleware = Deas::SummaryLogging.new(@app, @logger)
end
subject{ @middleware }
should "call the app and return its response when called" do
response = subject.call(@env)