Sha256: 2669fdc63c32b3f97319063f2a71b40d6d2fc94e6365726674e8a4986678c383

Contents?: true

Size: 810 Bytes

Versions: 15

Compression:

Stored size: 810 Bytes

Contents

require 'spec_helper'
require 'rack/test'
require 'async_rack_test'

describe Firehose::Rack::Ping, :type => :request do
  include AsyncRackTest::Methods
  let(:app) { Firehose::Rack::Ping.new dummy_redis }
  let(:path) { "/test/path/#{Time.now.to_i}" }
  let(:deferrable) { EM::DefaultDeferrable.new }
  let(:dummy_redis) { double 'redis', :set => deferrable, :get => deferrable, :expire => deferrable }

  context 'redis is available' do
    before { deferrable.succeed Firehose::Rack::Ping::PingCheck::TEST_VALUE }

    it "should return 200" do
      ahead path
      last_response.status.should == 200
    end
  end

  context 'redis is not available' do
    before { deferrable.fail 'some error' }
    it "should return 500" do
      ahead path
      last_response.status.should == 500
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
firehose-1.2.20 spec/lib/rack/ping_spec.rb
firehose-1.2.13 spec/lib/rack/ping_spec.rb
firehose-1.2.12 spec/lib/rack/ping_spec.rb
firehose-1.2.11 spec/lib/rack/ping_spec.rb
firehose-1.2.10 spec/lib/rack/ping_spec.rb
firehose-1.2.9 spec/lib/rack/ping_spec.rb
firehose-1.2.8 spec/lib/rack/ping_spec.rb
firehose-1.2.7 spec/lib/rack/ping_spec.rb
firehose-1.2.6 spec/lib/rack/ping_spec.rb
firehose-1.2.5 spec/lib/rack/ping_spec.rb
firehose-1.2.4 spec/lib/rack/ping_spec.rb
firehose-1.2.3 spec/lib/rack/ping_spec.rb
firehose-1.2.2 spec/lib/rack/ping_spec.rb
firehose-1.2.1 spec/lib/rack/ping_spec.rb
firehose-1.2.0 spec/lib/rack/ping_spec.rb