spec/config_spec.rb in sdbport-0.2.1 vs spec/config_spec.rb in sdbport-0.3.0

- old
+ new

@@ -1,27 +1,31 @@ require 'spec_helper' describe Sdbport do before do - @config = { 'access_key ' => 'key', - 'secret_key ' => 'secret' } + @config = { + 'test123' => { + 'access_key' => 'key', + 'secret_key' => 'secret' + } + } end it "should create a new config object and read from ~/.sdbport.yml" do File.stub :exists? => true File.should_receive(:open). with("#{ENV['HOME']}/.sdbport.yml"). and_return @config.to_yaml config = Sdbport::Config.new - config.access_key.should == @config['access_key'] - config.secret_key.should == @config['secret_key'] + config.access_key('test123').should == 'key' + config.secret_key('test123').should == 'secret' end - it "should load a blank config if the file does not exist and no config passed" do + it "should return nil if .sdbport.yml does not exist" do File.stub :exists? => false config = Sdbport::Config.new - config.access_key.should be_nil - config.secret_key.should be_nil + config.access_key('test123').should be_nil + config.secret_key('test123').should be_nil end end