Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

specs

  • Loading branch information...
commit e75966e79ffe65fc791f16b6ec958de4f338a1f9 1 parent 7b97267
@adamwiggins adamwiggins authored
Showing with 61 additions and 0 deletions.
  1. +2 −0  README.rdoc
  2. +7 −0 Rakefile
  3. +21 −0 spec/base.rb
  4. +31 −0 spec/sumo_spec.rb
View
2  README.rdoc
@@ -58,6 +58,8 @@ Optional config you can include in config.yml:
If you run any production machines from your EC2 account, I recommend setting up a separate account for use with Sumo. It does not prompt for confirmation when terminating an instance or differentiate between instances started by it vs. instances started by other tools.
+You'll need Bacon and Mocha if you want to run the specs, and Jewler if you want to create gems.
+
== Features
Launch, ssh to, and terminate instances.
View
7 Rakefile
@@ -14,3 +14,10 @@ end
Jeweler::RubyforgeTasks.new
+desc 'Run specs'
+task :spec do
+ sh 'bacon -s spec/*_spec.rb'
+end
+
+task :default => :spec
+
View
21 spec/base.rb
@@ -0,0 +1,21 @@
+require File.dirname(__FILE__) + '/../lib/sumo'
+
+require 'bacon'
+require 'mocha/standalone'
+require 'mocha/object'
+
+class Bacon::Context
+ include Mocha::API
+
+ def initialize(name, &block)
+ @name = name
+ @before, @after = [
+ [lambda { mocha_setup }],
+ [lambda { mocha_verify ; mocha_teardown }]
+ ]
+ @block = block
+ end
+
+ def xit(desc, &bk)
+ end
+end
View
31 spec/sumo_spec.rb
@@ -0,0 +1,31 @@
+require File.dirname(__FILE__) + '/base'
+
+require 'fileutils'
+
+describe Sumo do
+ before do
+ @work_path = "/tmp/spec_#{Process.pid}/"
+ FileUtils.mkdir_p(@work_path)
+ File.open("#{@work_path}/config.yml", "w") do |f|
+ f.write YAML.dump({})
+ end
+
+ @sumo = Sumo.new
+ @sumo.stubs(:sumo_dir).returns(@work_path)
+ end
+
+ after do
+ FileUtils.rm_rf(@work_path)
+ end
+
+ it "defaults to user root if none is specified in the config" do
+ @sumo.config['user'].should == 'root'
+ end
+
+ it "uses specified user if one is in the config" do
+ File.open("#{@work_path}/config.yml", "w") do |f|
+ f.write YAML.dump('user' => 'joe')
+ end
+ @sumo.config['user'].should == 'joe'
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.