From fd814791bacb008fd74c18b5a09ced276aaf088f Mon Sep 17 00:00:00 2001 From: Wesley Beary Date: Thu, 2 Jul 2009 11:10:15 -0700 Subject: [PATCH] allow calling describe addresses with no params --- lib/fog/aws/ec2.rb | 2 +- spec/aws/ec2/describe_addresses_spec.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/fog/aws/ec2.rb b/lib/fog/aws/ec2.rb index 538924fe3..1d742b958 100644 --- a/lib/fog/aws/ec2.rb +++ b/lib/fog/aws/ec2.rb @@ -46,7 +46,7 @@ module Fog }, Fog::Parsers::AWS::EC2::AllocateAddress.new) end - def describe_addresses(public_ips) + def describe_addresses(public_ips = []) params, index = {}, 1 for public_ip in [*public_ips] params["PublicIp.#{index}"] = public_ip diff --git a/spec/aws/ec2/describe_addresses_spec.rb b/spec/aws/ec2/describe_addresses_spec.rb index b9e7a807c..48ba90328 100644 --- a/spec/aws/ec2/describe_addresses_spec.rb +++ b/spec/aws/ec2/describe_addresses_spec.rb @@ -10,7 +10,14 @@ describe 'EC2.describe_addresses' do ec2.release_address(@public_ip) end - it "should return proper attributes" do + it "should return proper attributes with no params" do + actual = ec2.describe_addresses + actual.body[:request_id].should be_a(String) + item = actual.body[:addresses].select {|address| address[:public_ip] == @public_ip} + item.should_not be_nil + end + + it "should return proper attributes for specific ip" do actual = ec2.describe_addresses(@public_ip) actual.body[:request_id].should be_a(String) item = actual.body[:addresses].select {|address| address[:public_ip] == @public_ip}