Sha256: 74ab9cff5e36a32eec61f6fa4d8b5e503412899e14c38be376429ac943fd2459
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'test_helper' module Chillout module Middleware class CreationsMonitorTest < ChilloutTestCase setup do @env = { 'HOST' => 'example.net' } @client = mock() end context "for call with model creation" do setup do @app = lambda do |env| Thread.current[:creations] = :creations [200, env, ['hello']] end @middleware = CreationsMonitor.new(@app, @client) end def test_behaves_like_rack_middleware @client.stubs(:send_creations) response = @middleware.call(@env) assert_equal [200, @env, ['hello']], response end def test_dispatch_creations_from_thread_current @client.expects(:send_creations).with(:creations) @middleware.call(@env) end end context "for call without model creation" do setup do @app = lambda do |env| [200, env, ['hello']] end @middleware = CreationsMonitor.new(@app, @client) end def test_behaves_like_rack_middleware response = @middleware.call(@env) assert_equal [200, @env, ['hello']], response end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chillout-0.2.1 | test/middleware/creations_monitor_test.rb |
chillout-0.2.0 | test/middleware/creations_monitor_test.rb |