Sha256: 47a59f3ff0b01be90b739f653519a197f52aafbb2d04de45731c4b19829922f7
Contents?: true
Size: 1.14 KB
Versions: 4
Compression:
Stored size: 1.14 KB
Contents
require 'test_helper' require 'chillout/creations_container' module Chillout class CreationsMonitorRackTest < ChilloutTestCase include Rack::Test::Methods def setup api_key = "xyz123" stub_api_request(api_key, "clients") stub_api_request(api_key, "metrics") @config = Chillout::Config.new(api_key) @client = Chillout::Client.new(@config) @client.start_worker end def app client = @client deepest_level = lambda do |env| Thread.current[:creations] = CreationsContainer.new 2.times { Thread.current[:creations].increment!("User") } 3.times { Thread.current[:creations].increment!("Cart") } [200, env, ['hello']] end Rack::Builder.new do use Middleware::CreationsMonitor, client run(deepest_level) end end def test_creations_values get "/" Thread.pass assert_equal 2, request_body["content"]["creations"]["User"] assert_equal 3, request_body["content"]["creations"]["Cart"] end private def request_body assert_request_body("metrics") { |body| return body } end end end
Version data entries
4 entries across 4 versions & 1 rubygems