Sha256: e1a88bf81cd786e3d03e9e1828b10f2b4126f9fde0331b691b4cc525e5f169e2
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' module ChefAPI describe Defaults do context 'without a config file' do before(:each) do allow(subject).to receive(:config).and_return(Hash.new) end it 'returns the default endpoint' do expect(subject.endpoint).to eq subject::ENDPOINT end it 'returns the default user agent' do expect(subject.user_agent).to eq subject::USER_AGENT end end context 'with a config file' do before(:each) do subject.instance_variable_set(:@config, nil) allow(File).to receive(:exist?).with(anything()).and_return(true) allow(File).to receive(:read).and_return("{\n"\ "\"CHEF_API_ENDPOINT\": \"test_endpoint\",\n" \ "\"CHEF_API_USER_AGENT\": \"test_user_agent\"\n" \ "}" ) end it 'returns the overridden value for endpoint' do expect(subject.endpoint).to eq 'test_endpoint' end it 'returns the overridden value for user agent' do expect(subject.user_agent).to eq 'test_user_agent' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chef-api-0.7.0 | spec/unit/defaults_spec.rb |
chef-api-0.6.0 | spec/unit/defaults_spec.rb |