spec/unit/berkshelf/config_spec.rb in berkshelf-3.1.5 vs spec/unit/berkshelf/config_spec.rb in berkshelf-3.2.0

- old
+ new

@@ -1,11 +1,11 @@ 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) } + before { allow(File).to receive(:exists?).and_return(false) } it 'is nil' do expect(Berkshelf::Config.file).to be_nil end end @@ -21,20 +21,20 @@ it 'is a string' do expect(Berkshelf::Config.path).to be_a(String) end before do - File.stub(:exists?).and_return(false) + allow(File).to receive(: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) + allow(ENV).to receive(:[]).with('BERKSHELF_CONFIG').and_return('/tmp/config.json') + allow(File).to receive(:exists?).with('/tmp/config.json').and_return(true) end it "points to a location within it" do expect(Berkshelf::Config.path).to match(%r{/tmp/config.json}) end