spec/opsicle/cloneable_instance_spec.rb in opsicle-2.4.0 vs spec/opsicle/cloneable_instance_spec.rb in opsicle-2.4.1
- old
+ new
@@ -18,10 +18,11 @@
@layer = double('layer1', :name => 'layer-1', :layer_id => 12345, :instances => [@instance], :ami_id => nil, :agent_version => nil)
allow(@layer).to receive(:ami_id=)
allow(@layer).to receive(:ami_id)
allow(@layer).to receive(:agent_version=)
allow(@layer).to receive(:agent_version)
+ allow(@layer).to receive(:add_new_instance)
@new_instance = double('new_instance', :instance_id => 1029384756)
@opsworks = double('opsworks', :create_instance => @new_instance)
@cli = double('cli', :ask => 2)
end
@@ -37,11 +38,13 @@
it "should make a unique incremented hostname" do
instance = CloneableInstance.new(@instance, @layer, @opsworks, @cli)
instance1 = double('instance', :hostname => 'example-hostname-01')
instance2 = double('instance', :hostname => 'example-hostname-02')
- expect(@layer).to receive(:instances).and_return([instance1, instance2])
- instance.make_new_hostname('example-hostname-01')
+ instance3 = double('instance', :hostname => 'example-hostname-03')
+ instance4 = double('instance', :hostname => 'example-hostname-04')
+ expect(@layer).to receive(:instances).and_return([instance1, instance2, instance3, instance4])
+ expect(instance.make_new_hostname('example-hostname-01')).to eq('example-hostname-05')
end
end
context "#increment_hostname" do
it "should increment the hostname" do