Class: PoolParty::PluginSpecHelper
- Defined in:
- lib/helpers/plugin_spec_helper.rb
Class Method Summary collapse
Class Method Details
.define_instances(num) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/helpers/plugin_spec_helper.rb', line 27 def self.define_instances(num) # Too many gross evals returning [] do |arr| num.times do |i| eval <<-EOE @instance#{i} = RemoteInstance.new @instance#{i}.stub!(:ssh).and_return "true" @instance#{i}.stub!(:scp).and_return "true" @instance#{i}.stub!(:run).and_return "true" @instance#{i}.stub!(:name).and_return "node#{i}" @instance#{i}.stub!(:ip).and_return "127.0.0.#{i}" EOE arr << eval("@instance#{i}") end end end |
.define_stubs(klass, num = 1) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/helpers/plugin_spec_helper.rb', line 3 def self.define_stubs(klass, num=1) require File.dirname(__FILE__) + '/../../spec/helpers/ec2_mock' @klass = klass.send :new klass.stub!(:new).and_return @klass @master = Master.new @instances = define_instances(num) Master.stub!(:new).and_return @master @master.stub!(:execute_tasks).and_return true @master.stub!(:launch_minimum_instances).and_return true @master.stub!(:number_of_pending_instances).and_return 0 @master.stub!(:get_node).with(0).and_return @instance0 @master.stub!(:nodes).and_return @instances Kernel.stub!(:system).and_return "true" Provider.stub!(:install_poolparty).and_return true [@klass, @master, @instances] end |