spec/provider_spec.rb in service_config-0.0.2 vs spec/provider_spec.rb in service_config-0.1.0

- old
+ new

@@ -10,17 +10,27 @@ service_config.should respond_to(:foo) service_config.method(:foo).should_not be_nil service_config.foo.should == 'yo' end - it 'raises if an environment variable is not set, if configured' do + it 'raises if an environment variable is not set, if configured globally' do expect { build_service_config(:raise_if_nil => true) { |c| c.provides :unset } }.to raise_error('must set UNSET') expect { build_service_config(:raise_if_nil => false) { |c| c.provides :unset } }.not_to raise_error + end + + it 'raises if an environment variable is not set, if configured on specific variable' do + expect { + build_service_config(:raise_if_nil => false) { |c| c.provides :unset, nil, :raise_if_nil => true } + }.to raise_error('must set UNSET') + + expect { + build_service_config(:raise_if_nil => true) { |c| c.provides :unset, nil, :raise_if_nil => false } + }.to_not raise_error end it 'defines the value as "" if the environment variable is unset' do service_config = build_service_config(:raise_if_nil => false, :use_env => true) { |c| c.provides :unknown } service_config.unknown.should == ''