Sha256: a02bcb0743b754557e1ede6ba2ec95e6365bb95452e9262b6444dd756c9cd07f
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe Berkshelf::Config do describe '.file' do context 'when the file does not exist' do before { File.stub(:exists?).and_return(false) } it 'is nil' do expect(Berkshelf::Config.file).to be_nil end end end describe '.instance' do it 'should be a Berkshelf::Config' do expect(Berkshelf::Config.instance).to be_an_instance_of(Berkshelf::Config) end end describe '.path' do it 'is a string' do expect(Berkshelf::Config.path).to be_a(String) end before do File.stub(:exists?).and_return(false) end after do Berkshelf::Config.instance_variable_set(:@path, nil) end context "when ENV['BERKSHELF_CONFIG'] is used" do before do ENV.stub(:[]).with('BERKSHELF_CONFIG').and_return('/tmp/config.json') File.stub(:exists?).with('/tmp/config.json').and_return(true) end it "points to a location within it" do expect(Berkshelf::Config.path).to eq('/tmp/config.json') end end end describe "::set_path" do subject(:set_path) { described_class.set_path("/tmp/other_path.json") } it "sets the #instance to nil" do set_path expect(described_class.instance_variable_get(:@instance)).to be_nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
berkshelf-3.0.0.beta3 | spec/unit/berkshelf/config_spec.rb |
berkshelf-3.0.0.beta2 | spec/unit/berkshelf/config_spec.rb |
berkshelf-3.0.0.beta1 | spec/unit/berkshelf/config_spec.rb |