filling in more specs

This commit is contained in:
Wesley Beary 2009-10-09 22:54:17 -07:00
parent e760eb0a9c
commit 51dd8259ff
3 changed files with 44 additions and 13 deletions

View File

@ -2,8 +2,10 @@ module Fog
module AWS module AWS
class EC2 class EC2
def volumes def volumes(attributes = {})
Fog::AWS::EC2::Volumes.new(:connection => self) Fog::AWS::EC2::Volumes.new({
:connection => self
}.merge!(attributes))
end end
class Volumes < Fog::Collection class Volumes < Fog::Collection

View File

@ -4,14 +4,38 @@ describe 'Fog::AWS::EC2::Instance' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" # do it "should remap attributes from parser" do
# instance = Fog::AWS::EC2::Instance.new( instance = Fog::AWS::EC2::Instance.new({
# 'instanceId' => 'i-00000000', 'amiLaunchIndex' => 'ami_launch_index',
# 'publicIp' => '0.0.0.0' 'availabilityZone' => 'availability_zone',
# ) 'dnsName' => 'dns_name',
# instance.instance_id.should == 'i-00000000' 'groupId' => 'group_id',
# instance.public_ip.should == '0.0.0.0' 'imageId' => 'image_id',
# end 'instanceId' => 'instance_id',
'instanceState' => { 'name' => 'instance_state' },
'instanceType' => 'instance_type',
'kernelId' => 'kernel_id',
'keyName' => 'key_name',
'launchTime' => 'launch_time',
'productCodes' => 'product_codes',
'privateDnsName' => 'private_dns_name',
'ramdiskId' => 'ramdisk_id'
})
instance.ami_launch_index.should == 'ami_launch_index'
instance.availability_zone.should == 'availability_zone'
instance.dns_name.should == 'dns_name'
instance.group_id.should == 'group_id'
instance.image_id.should == 'image_id'
instance.instance_id.should == 'instance_id'
instance.instance_state.should == 'instance_state'
instance.instance_type.should == 'instance_type'
instance.kernel_id.should == 'kernel_id'
instance.key_name.should == 'key_name'
instance.launch_time.should == 'launch_time'
instance.product_codes.should == 'product_codes'
instance.private_dns_name.should == 'private_dns_name'
instance.ramdisk_id.should == 'ramdisk_id'
end
end end
@ -102,7 +126,12 @@ describe 'Fog::AWS::EC2::Instance' do
end end
describe "#volumes" do describe "#volumes" do
it "should have tests"
it "should return a Fog::AWS::EC2::Volumes" do
instance = ec2.instances.new
instance.volumes.should be_a(Fog::AWS::EC2::Volumes)
end
end end
end end

View File

@ -6,14 +6,14 @@ describe 'Fog::AWS::EC2::Volume' do
it "should remap attributes from parser" do it "should remap attributes from parser" do
volume = Fog::AWS::EC2::Volume.new( volume = Fog::AWS::EC2::Volume.new(
'attachmentTime' => 'now', 'attachTime' => 'now',
'availabilityZone' => 'us-east-1a', 'availabilityZone' => 'us-east-1a',
'createTime' => 'recently', 'createTime' => 'recently',
'instanceId' => 'i-00000000', 'instanceId' => 'i-00000000',
'snapshotId' => 'snap-00000000', 'snapshotId' => 'snap-00000000',
'volumeId' => 'vol-00000000' 'volumeId' => 'vol-00000000'
) )
volume.attachment_time.should == 'now' volume.attach_time.should == 'now'
volume.availability_zone.should == 'us-east-1a' volume.availability_zone.should == 'us-east-1a'
volume.create_time.should == 'recently' volume.create_time.should == 'recently'
volume.instance_id.should == 'i-00000000' volume.instance_id.should == 'i-00000000'