Sha256: 59ef01c54fc03a38cd269a958bcdbb774c94dd9d6823f37b69ce85f6166c890f
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe Mina::Configuration do let(:config) { Class.new(Mina::Configuration).instance } let(:key) { config.fetch(:key, :default) } describe '#set' do it 'sets by value' do config.set(:key, :value) expect(key).to eq :value end it 'sets by block' do config.set(:key) { :value } expect(key).to eq :value end end describe '#fetch' do it 'returns the default value if key not set' do expect(key).to eq :default end it 'returns ENV value if set' do ENV['key'] = 'env' expect(key).to eq 'env' ENV['key'] = nil end end describe '#set?' do it 'returns true if key is set' do config.set(:key, :value) expect(config.set?(:key)).to be true end it 'returns false if key is not set' do expect(config.set?(:key)).to be false end end describe '#ensure!' do it 'does not raise error if key is set' do config.set(:key, :value) expect { config.ensure!(:key) }.to_not raise_error end it 'raises an error if key is not set' do expect { config.ensure!(:key) }.to raise_error(StandardError) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mina-1.0.0.beta1 | spec/lib/mina/configuration_spec.rb |