Permalink
Browse files

fixed deregister_instances_from_load_balancer (issue #12)

  • Loading branch information...
1 parent d5537e6 commit b0b14ecdf4066dbe139f73bf5325665b41e45df6 Chris Johnson committed Apr 13, 2010
Showing with 4 additions and 4 deletions.
  1. +1 −1 lib/AWS/ELB/load_balancers.rb
  2. +3 −3 test/test_ELB_load_balancers.rb
View
2 lib/AWS/ELB/load_balancers.rb
@@ -115,7 +115,7 @@ def deregister_instances_from_load_balancer( options = {} )
raise ArgumentError, "No :instances provided" if options[:instances].nil? || options[:instances].empty?
raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
params = {}
- params.merge!(pathlist('Instances.member', [options[:instances]].flatten))
+ params.merge!(pathhashlist('Instances.member', options[:instances].flatten.collect{|e| {:instance_id => e}}, {:instance_id => 'InstanceId'}))
params['LoadBalancerName'] = options[:load_balancer_name]
return response_generator(:action => "DeregisterInstancesFromLoadBalancer", :params => params)
end
View
6 test/test_ELB_load_balancers.rb
@@ -184,10 +184,10 @@
lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params.merge(:instances=>[])) }.should.raise(AWS::ArgumentError)
end
- specify "should be able to degresiter instances from load balancers with degregister_instances_from_load_balancer" do
+ specify "should be able to deregister instances from load balancers with deregister_instances_from_load_balancer" do
@elb.stubs(:make_request).with('DeregisterInstancesFromLoadBalancer', {
'LoadBalancerName' => 'Test Name',
- 'Instances.member.1' => 'i-6055fa09'
+ 'Instances.member.1.InstanceId' => 'i-6055fa09'
}).returns stub(:body => @deregister_instances_from_load_balancer_response_body, :is_a? => true)
response = @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params)
@@ -197,7 +197,7 @@
specify "method deregister_instances_from_load_balancer should reject bad arguments" do
@elb.stubs(:make_request).with('DeregisterInstancesFromLoadBalancer', {
'LoadBalancerName' => 'Test Name',
- 'Instances.member.1' => 'i-6055fa09'
+ 'Instances.member.1.InstanceId' => 'i-6055fa09'
}).returns stub(:body => @deregister_instances_from_load_balancer_response_body, :is_a? => true)
lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params) }.should.not.raise(AWS::ArgumentError)

0 comments on commit b0b14ec

Please sign in to comment.