Sha256: e37a1c824c7778bda325695bee83a359283c4b7c4d5ebbfd95e413c62703580f

Contents?: true

Size: 1.75 KB

Versions: 19

Compression:

Stored size: 1.75 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

include PoolParty::Resources

class TestClass
  include PoolParty::Resources
end
describe "Remote Instance" do
  before(:each) do
    reset_resources!
    Kernel.stub!(:system).and_return true
  end
  describe "wrapped" do
    before(:each) do
      @tc = TestClass.new      
      @cloud = MyOpenStruct.new(:keypair => "keys", :remote_keypair_path => "/keypair_path", :name => "cloudcloud")
      @cloud.stub!(:is_a?).with(PoolParty::Cloud::Cloud).and_return true
      @tc.stub!(:parent).and_return @cloud
      
      @options = {:name => "deploydirectory", :from => ::File.dirname(__FILE__), :to => "/var/www/deploydirectory", :testing => false}
    end
    it "should be a string" do
      @tc.has_deploydirectory(@options).to_string.should =~ /exec \{/
    end
    it "should included the flushed out options" do
      @tc.has_deploydirectory(@options).to_string.should =~ /command/
    end
    describe "in resource" do
      before(:each) do
        @tc.instance_eval do
          has_deploydirectory do
            name "deploydirectory"
            from ::File.dirname(__FILE__)
            to "/var/www/deploydirectory"
          end
        end
      end
      it "should have the path set within the resource" do
        @tc.resource(:deploydirectory).first.to_string.should =~ /exec \{/
      end
      it "should not have the from in the to_string" do
        @tc.resource(:deploydirectory).first.to_string.should_not =~ /from /
      end
      it "should not have the to in the to_string" do
        @tc.resource(:deploydirectory).first.to_string.should_not =~ /to /
      end
      it "should have onlyif in the to_string" do
        @tc.resource(:deploydirectory).first.to_string.should =~ /onlyif/
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
auser-poolparty-0.2.72 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.74 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.76 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.77 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.78 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.79 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.80 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.81 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.84 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.85 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.88 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.89 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.90 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.91 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.92 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.93 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.94 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-1.0.0 spec/poolparty/plugins/deploydirectory_spec.rb
poolparty-0.2.84 spec/poolparty/plugins/deploydirectory_spec.rb