Sha256: 0ac676a68862e7769569e4c86bb11f708fe52526fc2cbce453a2294b70ae5d4b
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'rack/when' describe 'setting up for environments' do [:development, :test, :staging, :production].each do |env| before do allow(Rack::When::Builder).to receive(:new).and_return(builder) end let(:builder) { double "builder", mount: nil } let(:block) { double "block" } context "implicit #{env}" do it 'sets up a builder with the environment and the current context as rackup' do Rack::When.send env, &(block = -> { }) expect(Rack::When::Builder).to have_received(:new).with(env.to_sym,block) end it 'mounts the builder with caller as rackup' do Rack::When.send(env) { } expect(builder).to have_received(:mount) end end context "explicit #{env}" do it 'sets up a builder with the environment and the current context as rackup' do Rack::When.environment env, &(block = -> { }) expect(Rack::When::Builder).to have_received(:new).with(env.to_sym,block) end it 'mounts the builder with caller as rackup' do Rack::When.environment(env) { } expect(builder).to have_received(:mount) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-when-0.0.2 | spec/rack/when_spec.rb |
rack-when-0.0.1 | spec/rack/when_spec.rb |