Sha256: e2c6c096562c2193b476a50bda6512aab920747dd4d936220f95ae5024362287

Contents?: true

Size: 1.96 KB

Versions: 13

Compression:

Stored size: 1.96 KB

Contents

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

class ResourcerTestClass < PoolParty::Cloud::Cloud  
  default_options({
    :minimum_runtime => 50.minutes
  })
end
class TestParentClass < PoolParty::Cloud::Cloud  
  # def services
  #   @services ||= []
  # end
  # def add_service(s)
  #   services << s
  # end
end
describe "CloudResourcer" do
  before(:each) do
    @tc = ResourcerTestClass.new :bank do
    end
  end
  it "should have the method instances" do
    @tc.respond_to?(:instances).should == true
  end
  it "should be able to accept a range and set the first to the minimum instances" do
    @tc.instances 4..10
    @tc.minimum_instances.should == 4
  end
  it "should be able to accept a Fixnum and set the minimum_instances and maximum_instances" do
    @tc.instances 1
    @tc.minimum_instances.should == 1
    @tc.maximum_instances.should == 1
  end
  it "should set the max to the maximum instances to the last in a given range" do
    @tc.instances 4..10
    @tc.maximum_instances.should == 10
  end
  it "should have default minimum_runtime of 50 minutes (3000 seconds)" do
    Default.stub!(:minimum_runtime).and_return 50.minutes
    @tc.minimum_runtime.should ==  50.minutes
  end
  it "should have minimum_runtime" do
    @tc.minimum_runtime 40.minutes
    @tc.minimum_runtime.should == 40.minutes
  end
  describe "parents" do
    before(:each) do
      @testparent = 
      TestParentClass.new(:parent_of_bob) do
        test_option "blankity blank blank"
        
        ResourcerTestClass.new :bob do
        end
      end
      describe "setting" do
        it "set 1 service on the parent class" do
          @testparent.services.size.should == 1
        end
        it "set the service as a ResourcerTestClass named bob" do
          @testparent.services.first.name.should == :bob
        end
        it "set the parent's options on the child" do
          @testparent.services.first.test_option.should == "blankity blank blank"
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
auser-poolparty-1.1.1 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.1.3 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.1.4 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.1.5 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.1.6 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.1.7 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.2.0 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.2.1 spec/poolparty/modules/cloud_resourcer_spec.rb
auser-poolparty-1.2.2 spec/poolparty/modules/cloud_resourcer_spec.rb
fairchild-poolparty-1.1.3 spec/poolparty/modules/cloud_resourcer_spec.rb
fairchild-poolparty-1.1.4 spec/poolparty/modules/cloud_resourcer_spec.rb
fairchild-poolparty-1.1.5 spec/poolparty/modules/cloud_resourcer_spec.rb
poolparty-1.2.2 spec/poolparty/modules/cloud_resourcer_spec.rb