Sha256: 46576ebf48543769c27a3e86e265536e8b939c78ac439facce8bee865421f9f7
Contents?: true
Size: 857 Bytes
Versions: 9
Compression:
Stored size: 857 Bytes
Contents
require 'spec_helper' Goliath.env = :development class ReloaderDev < Goliath::API use Goliath::Rack::Params end class ReloaderAlreadyLoaded < Goliath::API use ::Rack::Reloader, 0 use Goliath::Rack::Params end class ReloaderProd < Goliath::API end describe "Reloader" do let(:err) { Proc.new { fail "API request failed" } } before(:each) { Goliath.env = :development } after(:each) { Goliath.env = :test } def count(klass) cnt = 0 klass.middlewares.each do |mw| cnt += 1 if mw.first == ::Rack::Reloader end cnt end it 'adds reloader in dev mode' do count(ReloaderDev).should == 1 end it "doesn't add if it's already there in dev mode" do count(ReloaderAlreadyLoaded).should == 1 end it "doesn't add in prod mode" do Goliath.env = :production count(ReloaderProd).should == 0 end end
Version data entries
9 entries across 9 versions & 1 rubygems