Sha256: 761f0c2875a9e79ef37093053a36010426e1beba46588453605fc3c1612b0d04
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
require File.expand_path '../helper', __FILE__ class RackTest < Test::Unit::TestCase should "call the upstream app with the environment" do environment = { 'key' => 'value' } app = lambda { |env| ['response', {}, env] } stack = Pulse::Rack.new(app) response = stack.call(environment) assert_equal ['response', {}, environment], response end should "deliver an exception raised while calling an upstream app" do Pulse.stubs(:notify_or_ignore) exception = build_exception environment = { 'key' => 'value' } app = lambda do |env| raise exception end begin stack = Pulse::Rack.new(app) stack.call(environment) rescue Exception => raised assert_equal exception, raised else flunk "Didn't raise an exception" end assert_received(Pulse, :notify_or_ignore) do |expect| expect.with(exception, :rack_env => environment) end end should "deliver an exception in rack.exception" do Pulse.stubs(:notify_or_ignore) exception = build_exception environment = { 'key' => 'value' } response = [200, {}, ['okay']] app = lambda do |env| env['rack.exception'] = exception response end stack = Pulse::Rack.new(app) actual_response = stack.call(environment) assert_equal response, actual_response assert_received(Pulse, :notify_or_ignore) do |expect| expect.with(exception, :rack_env => environment) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
projectlocker_pulse-1.0.0 | test/rack_test.rb |
projectlocker_pulse-0.2.1 | test/rack_test.rb |