Sha256: 563635d89766c9862b5bf4e4e2e32e52917954d17ffa2ac16182282d72e3613d

Contents?: true

Size: 1.71 KB

Versions: 14

Compression:

Stored size: 1.71 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!
  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

14 entries across 14 versions & 2 rubygems

Version Path
auser-poolparty-0.2.59 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.60 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.61 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.62 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.63 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.64 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.65 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.66 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.67 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.68 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.69 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.70 spec/poolparty/plugins/deploydirectory_spec.rb
auser-poolparty-0.2.71 spec/poolparty/plugins/deploydirectory_spec.rb
poolparty-0.2.69 spec/poolparty/plugins/deploydirectory_spec.rb