Sha256: ab08d3317504d5ee65db8a5ebe33a7da3d7778b21896ea5cfb841fc458357c28
Contents?: true
Size: 1.23 KB
Versions: 7
Compression:
Stored size: 1.23 KB
Contents
require 'test_helper' module Chillout module Middleware class CreationsMonitorTest < ChilloutTestCase def setup @env = { 'HOST' => 'example.net' } @logger = stub(info: "", debug: "") @client = stub(logger: @logger) end def call_with_model_creation @app = lambda do |env| Chillout.creations = :creations [200, env, ['hello']] end @middleware = CreationsMonitor.new(@app, @client) end def test_behaves_like_rack_middleware call_with_model_creation @client.stubs(:enqueue) response = @middleware.call(@env) assert_equal [200, @env, ['hello']], response end def test_clients_queue_receive_creations call_with_model_creation @client.expects(:enqueue).with(:creations) @middleware.call(@env) end def call_without_model_creation @app = lambda do |env| [200, env, ['hello']] end @middleware = CreationsMonitor.new(@app, @client) end def test_behaves_like_rack_middleware call_without_model_creation response = @middleware.call(@env) assert_equal [200, @env, ['hello']], response end end end end
Version data entries
7 entries across 7 versions & 1 rubygems