spec/application_spec.rb in auser-poolparty-0.0.8 vs spec/application_spec.rb in auser-poolparty-0.0.9
- old
+ new
@@ -1,8 +1,11 @@
require File.dirname(__FILE__) + '/spec_helper'
describe "Application" do
+ before(:each) do
+ stub_option_load
+ end
it "should be able to send options in the Application.options" do
options({:optparse => {:banner => "hi"}})
end
it "should have the root_dir defined" do
PoolParty.root_dir.should_not be_nil
@@ -33,7 +36,32 @@
it "should be able to show the version of the gem" do
Application.version.should_not be_nil
end
it "should show the version as a string" do
Application.version.class.should == String
+ end
+ it "should be able to start instances with the the key access information on the user-data" do
+ Application.launching_user_data.should =~ /:access_key/
+ Application.launching_user_data.should =~ /:secret_access_key/
+ end
+ it "should be able to pull out the access_key from the user data" do
+ Application.local_user_data[:access_key].should == 3.14159
+ end
+ it "should overwrite the default_options when passing in to the instance data" do
+ Application.stub!(:default_options).and_return({:access_key => 42})
+ Application.options.access_key.should == 3.14159
+ end
+ it "should parse and use a config file if it is given for the options" do
+ YAML.should_receive(:load).and_return({:config_file => "config/sample-config.yml"})
+ Application.make_options(:config_file => "config/sample-config.yml")
+ end
+ it "should not read the config file if it is not passed and doesn't exist" do
+ File.stub!(:file?).and_return false
+ YAML.should_not_receive(:load)
+ Application.make_options
+ end
+ it "should not read the config file if it is passed and doesn't exist" do
+ File.stub!(:file?).and_return false
+ YAML.should_not_receive(:load)
+ Application.make_options(:config_file => "ted")
end
end
\ No newline at end of file