Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[aws|elb] load_balancers.get(nil) returns nil instead of the first of…

… all load balancers.
  • Loading branch information...
commit 3e5020f2b37a008005bfdc476dc085f35b0749d6 1 parent 4a4c402
@dpiddy dpiddy authored
View
6 lib/fog/aws/models/elb/load_balancers.rb
@@ -24,8 +24,10 @@ def all
end
def get(identity)
- data = connection.describe_load_balancers('LoadBalancerNames' => identity).body['DescribeLoadBalancersResult']['LoadBalancerDescriptions'].first
- new(data)
+ if identity
+ data = connection.describe_load_balancers('LoadBalancerNames' => identity).body['DescribeLoadBalancersResult']['LoadBalancerDescriptions'].first
+ new(data)
+ end
rescue Fog::AWS::ELB::NotFound
nil
end
View
4 tests/aws/models/elb/model_tests.rb
@@ -129,8 +129,8 @@
end
tests('get') do
- elb_get = Fog::AWS[:elb].load_balancers.get(elb_id)
- tests('ids match').returns(elb_id) { elb_get.id }
+ tests('ids match').returns(elb_id) { Fog::AWS[:elb].load_balancers.get(elb_id).id }
+ tests('nil id').returns(nil) { Fog::AWS[:elb].load_balancers.get(nil) }
end
tests('creating a duplicate elb') do
Please sign in to comment.
Something went wrong with that request. Please try again.