spec/rack/when/builder_spec.rb in rack-when-0.0.2 vs spec/rack/when/builder_spec.rb in rack-when-0.0.3
- old
+ new
@@ -1,8 +1,11 @@
require 'rack/when/builder'
describe 'An environment sensitive rack builder' do
+ before do
+ stub_const("ENV",{})
+ end
describe '#mount rack_up' do
let(:builder) { Rack::When::Builder.new @env, block }
let(:block) { double "block" }
let(:mount_builder) { builder.mount }
@@ -61,8 +64,15 @@
it_should_behave_like 'matching environment'
end
context 'environment not set' do
it_should_behave_like 'matching environment'
+ end
+
+ it 'matches when one of multiple envs match' do
+ ENV['RACK_ENV'] = 'custom'
+ expect(Rack::When::Builder.new :dev, :custom, double ).to have_matching_env
+ expect(Rack::When::Builder.new :custom, :test, double ).to have_matching_env
+ expect(Rack::When::Builder.new :dev, :test, double ).to_not have_matching_env
end
end
end