2009-08-17 15:55:30 -07:00
|
|
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2009-07-01 10:14:07 -07:00
|
|
|
|
2009-08-01 01:15:44 -07:00
|
|
|
describe 'EC2.release_address' do
|
2009-08-19 20:32:57 -07:00
|
|
|
describe 'success' do
|
2009-07-01 10:14:07 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
before(:each) do
|
2009-08-19 19:11:57 -07:00
|
|
|
@public_ip = ec2.allocate_address.body['publicIp']
|
|
|
|
end
|
2009-07-01 10:14:07 -07:00
|
|
|
|
2009-08-19 19:11:57 -07:00
|
|
|
it "should return proper attributes" do
|
|
|
|
actual = ec2.release_address(@public_ip)
|
|
|
|
actual.body['requestId'].should be_a(String)
|
|
|
|
actual.body['return'].should == true
|
|
|
|
end
|
2009-07-01 10:14:07 -07:00
|
|
|
|
2009-08-16 21:37:18 -07:00
|
|
|
end
|
2009-08-19 20:32:57 -07:00
|
|
|
describe 'failure' do
|
2009-08-16 21:37:18 -07:00
|
|
|
|
2009-08-19 19:11:57 -07:00
|
|
|
it "should raise a BadRequest error if address does not exist" do
|
|
|
|
lambda {
|
|
|
|
ec2.release_address('127.0.0.1')
|
2009-10-31 12:26:49 -07:00
|
|
|
}.should raise_error(Excon::Errors::BadRequest)
|
2009-08-19 19:11:57 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-01 10:14:07 -07:00
|
|
|
end
|