fog 0.0.40 → 0.0.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/README.rdoc +2 -0
  2. data/Rakefile +12 -0
  3. data/VERSION +1 -1
  4. data/bin/fog +28 -40
  5. data/fog.gemspec +16 -3
  6. data/lib/fog.rb +27 -3
  7. data/lib/fog/aws/ec2.rb +7 -3
  8. data/lib/fog/aws/models/ec2/security_group.rb +1 -1
  9. data/lib/fog/aws/models/ec2/server.rb +8 -3
  10. data/lib/fog/aws/models/ec2/servers.rb +1 -1
  11. data/lib/fog/aws/parsers/ec2/terminate_instances.rb +10 -10
  12. data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
  13. data/lib/fog/aws/s3.rb +6 -2
  14. data/lib/fog/rackspace.rb +8 -2
  15. data/lib/fog/slicehost.rb +3 -1
  16. data/spec/aws/models/ec2/address_spec.rb +8 -8
  17. data/spec/aws/models/ec2/addresses_spec.rb +10 -10
  18. data/spec/aws/models/ec2/key_pair_spec.rb +8 -8
  19. data/spec/aws/models/ec2/key_pairs_spec.rb +10 -10
  20. data/spec/aws/models/ec2/security_group_spec.rb +8 -8
  21. data/spec/aws/models/ec2/security_groups_spec.rb +10 -10
  22. data/spec/aws/models/ec2/server_spec.rb +1 -4
  23. data/spec/aws/models/ec2/servers_spec.rb +1 -1
  24. data/spec/aws/models/ec2/snapshot_spec.rb +12 -10
  25. data/spec/aws/models/ec2/snapshots_spec.rb +20 -20
  26. data/spec/aws/models/ec2/volume_spec.rb +10 -10
  27. data/spec/aws/models/ec2/volumes_spec.rb +10 -10
  28. data/spec/aws/models/s3/directories_spec.rb +8 -8
  29. data/spec/aws/models/s3/directory_spec.rb +11 -11
  30. data/spec/aws/models/s3/file_spec.rb +2 -2
  31. data/spec/aws/models/s3/files_spec.rb +2 -2
  32. data/spec/aws/requests/ec2/allocate_address_spec.rb +2 -2
  33. data/spec/aws/requests/ec2/associate_address_spec.rb +15 -13
  34. data/spec/aws/requests/ec2/attach_volume_spec.rb +12 -12
  35. data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +3 -3
  36. data/spec/aws/requests/ec2/create_key_pair_spec.rb +5 -5
  37. data/spec/aws/requests/ec2/create_security_group_spec.rb +5 -5
  38. data/spec/aws/requests/ec2/create_snapshot_spec.rb +5 -5
  39. data/spec/aws/requests/ec2/create_volume_spec.rb +2 -2
  40. data/spec/aws/requests/ec2/delete_key_pair_spec.rb +3 -3
  41. data/spec/aws/requests/ec2/delete_security_group_spec.rb +3 -3
  42. data/spec/aws/requests/ec2/delete_snapshot_spec.rb +5 -5
  43. data/spec/aws/requests/ec2/delete_volume_spec.rb +3 -3
  44. data/spec/aws/requests/ec2/describe_addresses_spec.rb +5 -5
  45. data/spec/aws/requests/ec2/describe_availability_zones_spec.rb +2 -2
  46. data/spec/aws/requests/ec2/describe_images_spec.rb +2 -2
  47. data/spec/aws/requests/ec2/describe_instances_spec.rb +5 -5
  48. data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +5 -5
  49. data/spec/aws/requests/ec2/describe_regions_spec.rb +2 -2
  50. data/spec/aws/requests/ec2/describe_security_groups_spec.rb +5 -5
  51. data/spec/aws/requests/ec2/describe_snapshots_spec.rb +7 -7
  52. data/spec/aws/requests/ec2/describe_volumes_spec.rb +5 -5
  53. data/spec/aws/requests/ec2/detach_volume_spec.rb +7 -7
  54. data/spec/aws/requests/ec2/disassociate_address_spec.rb +9 -7
  55. data/spec/aws/requests/ec2/get_console_output_spec.rb +4 -4
  56. data/spec/aws/requests/ec2/reboot_instances_spec.rb +4 -4
  57. data/spec/aws/requests/ec2/release_address_spec.rb +3 -3
  58. data/spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb +4 -4
  59. data/spec/aws/requests/ec2/run_instances_spec.rb +2 -2
  60. data/spec/aws/requests/ec2/terminate_instances_spec.rb +7 -7
  61. data/spec/aws/requests/s3/copy_object_spec.rb +11 -11
  62. data/spec/aws/requests/s3/delete_bucket_spec.rb +8 -8
  63. data/spec/aws/requests/s3/delete_object_spec.rb +8 -8
  64. data/spec/aws/requests/s3/get_bucket_location_spec.rb +4 -4
  65. data/spec/aws/requests/s3/get_bucket_spec.rb +12 -12
  66. data/spec/aws/requests/s3/get_object_spec.rb +9 -9
  67. data/spec/aws/requests/s3/get_request_payment_spec.rb +4 -4
  68. data/spec/aws/requests/s3/get_service_spec.rb +4 -4
  69. data/spec/aws/requests/s3/head_object_spec.rb +5 -5
  70. data/spec/aws/requests/s3/put_bucket_spec.rb +3 -3
  71. data/spec/aws/requests/s3/put_object_spec.rb +11 -11
  72. data/spec/aws/requests/s3/put_request_payment_spec.rb +4 -4
  73. data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +4 -4
  74. data/spec/aws/requests/simpledb/create_domain_spec.rb +4 -4
  75. data/spec/aws/requests/simpledb/delete_attributes_spec.rb +8 -8
  76. data/spec/aws/requests/simpledb/delete_domain_spec.rb +3 -3
  77. data/spec/aws/requests/simpledb/domain_metadata_spec.rb +6 -6
  78. data/spec/aws/requests/simpledb/get_attributes_spec.rb +9 -9
  79. data/spec/aws/requests/simpledb/list_domains_spec.rb +4 -4
  80. data/spec/aws/requests/simpledb/put_attributes_spec.rb +4 -4
  81. data/spec/compact_progress_bar_formatter.rb +195 -0
  82. data/spec/rackspace/models/servers/server_spec.rb +1 -1
  83. data/spec/rackspace/requests/files/delete_container_spec.rb +3 -3
  84. data/spec/rackspace/requests/files/delete_object_spec.rb +8 -8
  85. data/spec/rackspace/requests/files/get_container_spec.rb +6 -6
  86. data/spec/rackspace/requests/files/get_containers_spec.rb +3 -3
  87. data/spec/rackspace/requests/files/head_container_spec.rb +6 -6
  88. data/spec/rackspace/requests/files/head_containers_spec.rb +3 -3
  89. data/spec/rackspace/requests/files/put_container_spec.rb +2 -2
  90. data/spec/rackspace/requests/files/put_object_spec.rb +4 -4
  91. data/spec/rackspace/requests/servers/create_image_spec.rb +4 -4
  92. data/spec/rackspace/requests/servers/create_server_spec.rb +2 -2
  93. data/spec/rackspace/requests/servers/delete_image_spec.rb +5 -5
  94. data/spec/rackspace/requests/servers/delete_server_spec.rb +3 -3
  95. data/spec/rackspace/requests/servers/get_flavor_details_spec.rb +1 -1
  96. data/spec/rackspace/requests/servers/get_server_details_spec.rb +4 -4
  97. data/spec/rackspace/requests/servers/list_addresses_spec.rb +4 -4
  98. data/spec/rackspace/requests/servers/list_flavors_detail_spec.rb +1 -1
  99. data/spec/rackspace/requests/servers/list_flavors_spec.rb +1 -1
  100. data/spec/rackspace/requests/servers/list_images_detail_spec.rb +1 -1
  101. data/spec/rackspace/requests/servers/list_images_spec.rb +1 -1
  102. data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +4 -4
  103. data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +4 -4
  104. data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +3 -3
  105. data/spec/rackspace/requests/servers/list_servers_spec.rb +3 -3
  106. data/spec/rackspace/requests/servers/reboot_server_spec.rb +4 -4
  107. data/spec/rackspace/requests/servers/update_server_spec.rb +4 -4
  108. data/spec/slicehost/requests/create_slice_spec.rb +2 -2
  109. data/spec/slicehost/requests/delete_slice_spec.rb +2 -2
  110. data/spec/slicehost/requests/get_backups_spec.rb +1 -1
  111. data/spec/slicehost/requests/get_flavors_spec.rb +1 -1
  112. data/spec/slicehost/requests/get_images_spec.rb +1 -1
  113. data/spec/slicehost/requests/get_slices_spec.rb +1 -1
  114. data/spec/spec_helper.rb +60 -38
  115. metadata +16 -3
  116. data/spec/spec.opts +0 -1
@@ -4,15 +4,15 @@ describe 'EC2.describe_security_groups' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- ec2.create_security_group('fog_security_group', 'a security group for testing fog')
7
+ AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
8
8
  end
9
9
 
10
10
  after(:each) do
11
- ec2.delete_security_group('fog_security_group')
11
+ AWS[:ec2].delete_security_group('fog_security_group')
12
12
  end
13
13
 
14
14
  it "should return proper attributes with no params" do
15
- actual = ec2.describe_security_groups
15
+ actual = AWS[:ec2].describe_security_groups
16
16
  actual.body['requestId'].should be_a(String)
17
17
  actual.body['securityGroupInfo'].should be_an(Array)
18
18
  security_group = actual.body['securityGroupInfo'].select do |security_group|
@@ -26,7 +26,7 @@ describe 'EC2.describe_security_groups' do
26
26
  end
27
27
 
28
28
  it "should return proper attributes with params" do
29
- actual = ec2.describe_security_groups('fog_security_group')
29
+ actual = AWS[:ec2].describe_security_groups('fog_security_group')
30
30
  actual.body['requestId'].should be_a(String)
31
31
  actual.body['securityGroupInfo'].should be_an(Array)
32
32
  security_group = actual.body['securityGroupInfo'].select do |security_group|
@@ -43,7 +43,7 @@ describe 'EC2.describe_security_groups' do
43
43
 
44
44
  it "should raise a BadRequest error if the security group does not exist" do
45
45
  lambda {
46
- ec2.describe_security_groups('not_a_security_group')
46
+ AWS[:ec2].describe_security_groups('not_a_security_group')
47
47
  }.should raise_error(Excon::Errors::BadRequest)
48
48
  end
49
49
 
@@ -4,20 +4,20 @@ describe 'EC2.describe_snapshots' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
8
- @snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
7
+ @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
8
+ @snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
9
9
  end
10
10
 
11
11
  after(:each) do
12
- ec2.delete_volume(@volume_id)
12
+ AWS[:ec2].delete_volume(@volume_id)
13
13
  eventually do
14
- ec2.delete_snapshot(@snapshot_id)
14
+ AWS[:ec2].delete_snapshot(@snapshot_id)
15
15
  end
16
16
  end
17
17
 
18
18
  it "should return proper attributes with no params" do
19
19
  eventually do
20
- actual = ec2.describe_snapshots
20
+ actual = AWS[:ec2].describe_snapshots
21
21
  actual.body['snapshotSet'].should be_an(Array)
22
22
  snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
23
23
  snapshot['progress'].should be_a(String)
@@ -30,7 +30,7 @@ describe 'EC2.describe_snapshots' do
30
30
 
31
31
  it "should return proper attributes with params" do
32
32
  eventually do
33
- actual = ec2.describe_snapshots([@snapshot_id])
33
+ actual = AWS[:ec2].describe_snapshots([@snapshot_id])
34
34
  actual.body['snapshotSet'].should be_an(Array)
35
35
  snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
36
36
  snapshot['progress'].should be_a(String)
@@ -46,7 +46,7 @@ describe 'EC2.describe_snapshots' do
46
46
 
47
47
  it "should raise a BadRequest error if the snapshot does not exist" do
48
48
  lambda {
49
- ec2.describe_snapshots('snap-00000000')
49
+ AWS[:ec2].describe_snapshots('snap-00000000')
50
50
  }.should raise_error(Excon::Errors::BadRequest)
51
51
  end
52
52
 
@@ -4,15 +4,15 @@ describe 'EC2.describe_volumes' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
7
+ @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
8
8
  end
9
9
 
10
10
  after(:each) do
11
- ec2.delete_volume(@volume_id)
11
+ AWS[:ec2].delete_volume(@volume_id)
12
12
  end
13
13
 
14
14
  it "should return proper attributes with no params" do
15
- actual = ec2.describe_volumes
15
+ actual = AWS[:ec2].describe_volumes
16
16
  actual.body['requestId'].should be_a(String)
17
17
  volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
18
18
  volume['availabilityZone'].should be_a(String)
@@ -25,7 +25,7 @@ describe 'EC2.describe_volumes' do
25
25
  end
26
26
 
27
27
  it "should return proper attributes for specific volume" do
28
- actual = ec2.describe_volumes(@volume_id)
28
+ actual = AWS[:ec2].describe_volumes(@volume_id)
29
29
  actual.body['requestId'].should be_a(String)
30
30
  volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
31
31
  volume['availabilityZone'].should be_a(String)
@@ -42,7 +42,7 @@ describe 'EC2.describe_volumes' do
42
42
 
43
43
  it "should raise a BadRequest error if volume does not exist" do
44
44
  lambda {
45
- ec2.describe_volumes('vol-00000000')
45
+ AWS[:ec2].describe_volumes('vol-00000000')
46
46
  }.should raise_error(Excon::Errors::BadRequest)
47
47
  end
48
48
 
@@ -4,23 +4,23 @@ describe 'EC2.detach_volume' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @instance_id = ec2.run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
8
- @volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
7
+ @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
8
+ @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
9
9
  eventually(128) do
10
- ec2.attach_volume(@instance_id, @volume_id, '/dev/sdh')
10
+ AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
11
11
  end
12
12
  end
13
13
 
14
14
  after(:each) do
15
15
  eventually do
16
- ec2.delete_volume(@volume_id)
17
- ec2.terminate_instances([@instance_id])
16
+ AWS[:ec2].delete_volume(@volume_id)
17
+ AWS[:ec2].terminate_instances([@instance_id])
18
18
  end
19
19
  end
20
20
 
21
21
  it "should return proper attributes" do
22
22
  eventually do
23
- actual = ec2.detach_volume(@volume_id)
23
+ actual = AWS[:ec2].detach_volume(@volume_id)
24
24
  actual.body['attachTime'].should be_a(Time)
25
25
  actual.body['device'].should be_a(String)
26
26
  actual.body['instanceId'].should be_a(String)
@@ -35,7 +35,7 @@ describe 'EC2.detach_volume' do
35
35
 
36
36
  it "should raise a BadRequest error if the volume does not exist" do
37
37
  lambda {
38
- ec2.detach_volume('vol-00000000')
38
+ AWS[:ec2].detach_volume('vol-00000000')
39
39
  }.should raise_error(Excon::Errors::BadRequest)
40
40
  end
41
41
 
@@ -4,18 +4,20 @@ describe 'EC2.disassociate_address' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
8
- @public_ip = ec2.allocate_address.body['publicIp']
9
- ec2.associate_address(@instance_id, @public_ip)
7
+ @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
8
+ eventually(128) do
9
+ @public_ip = AWS[:ec2].allocate_address.body['publicIp']
10
+ AWS[:ec2].associate_address(@instance_id, @public_ip)
11
+ end
10
12
  end
11
13
 
12
14
  after(:each) do
13
- ec2.release_address(@public_ip)
14
- ec2.terminate_instances([@instance_id])
15
+ AWS[:ec2].release_address(@public_ip)
16
+ AWS[:ec2].terminate_instances([@instance_id])
15
17
  end
16
18
 
17
19
  it "should return proper attributes" do
18
- actual = ec2.disassociate_address(@public_ip)
20
+ actual = AWS[:ec2].disassociate_address(@public_ip)
19
21
  actual.body['requestId'].should be_a(String)
20
22
  [false, true].should include(actual.body['return'])
21
23
  end
@@ -26,7 +28,7 @@ describe 'EC2.disassociate_address' do
26
28
 
27
29
  it "should raise a BadRequest error if the address does not exist" do
28
30
  lambda {
29
- ec2.disassociate_address('127.0.0.1')
31
+ AWS[:ec2].disassociate_address('127.0.0.1')
30
32
  }.should raise_error(Excon::Errors::BadRequest)
31
33
  end
32
34
 
@@ -4,15 +4,15 @@ describe 'EC2.get_console_output' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
7
+ @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
8
8
  end
9
9
 
10
10
  after(:each) do
11
- ec2.terminate_instances([@instance_id])
11
+ AWS[:ec2].terminate_instances([@instance_id])
12
12
  end
13
13
 
14
14
  it "should return proper attributes" do
15
- actual = ec2.get_console_output(@instance_id)
15
+ actual = AWS[:ec2].get_console_output(@instance_id)
16
16
  actual.body['instanceId'].should be_a(String)
17
17
  actual.body['output'].should be_a(String)
18
18
  actual.body['requestId'].should be_a(String)
@@ -24,7 +24,7 @@ describe 'EC2.get_console_output' do
24
24
 
25
25
  it "should raise a BadRequest error if the instance does not exist" do
26
26
  lambda {
27
- ec2.get_console_output('i-00000000')
27
+ AWS[:ec2].get_console_output('i-00000000')
28
28
  }.should raise_error(Excon::Errors::BadRequest)
29
29
  end
30
30
 
@@ -4,15 +4,15 @@ describe 'EC2.reboot_instances' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
7
+ @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
8
8
  end
9
9
 
10
10
  after(:each) do
11
- ec2.terminate_instances(@instance_id)
11
+ AWS[:ec2].terminate_instances(@instance_id)
12
12
  end
13
13
 
14
14
  it "should return proper attributes" do
15
- actual = ec2.reboot_instances(@instance_id)
15
+ actual = AWS[:ec2].reboot_instances(@instance_id)
16
16
  actual.body['requestId'].should be_a(String)
17
17
  [false, true].should include(actual.body['return'])
18
18
  end
@@ -22,7 +22,7 @@ describe 'EC2.reboot_instances' do
22
22
 
23
23
  it "should raise a BadRequest error if the instance does not exist" do
24
24
  lambda {
25
- ec2.reboot_instances('i-00000000')
25
+ AWS[:ec2].reboot_instances('i-00000000')
26
26
  }.should raise_error(Excon::Errors::BadRequest)
27
27
  end
28
28
 
@@ -4,11 +4,11 @@ describe 'EC2.release_address' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @public_ip = ec2.allocate_address.body['publicIp']
7
+ @public_ip = AWS[:ec2].allocate_address.body['publicIp']
8
8
  end
9
9
 
10
10
  it "should return proper attributes" do
11
- actual = ec2.release_address(@public_ip)
11
+ actual = AWS[:ec2].release_address(@public_ip)
12
12
  actual.body['requestId'].should be_a(String)
13
13
  actual.body['return'].should == true
14
14
  end
@@ -18,7 +18,7 @@ describe 'EC2.release_address' do
18
18
 
19
19
  it "should raise a BadRequest error if address does not exist" do
20
20
  lambda {
21
- ec2.release_address('127.0.0.1')
21
+ AWS[:ec2].release_address('127.0.0.1')
22
22
  }.should raise_error(Excon::Errors::BadRequest)
23
23
  end
24
24
 
@@ -4,8 +4,8 @@ describe 'EC2.revoke_security_group_ingress' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- ec2.create_security_group('fog_security_group', 'a security group for testing fog')
8
- ec2.authorize_security_group_ingress({
7
+ AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
8
+ AWS[:ec2].authorize_security_group_ingress({
9
9
  'FromPort' => 80,
10
10
  'GroupName' => 'fog_security_group',
11
11
  'IpProtocol' => 'tcp',
@@ -14,11 +14,11 @@ describe 'EC2.revoke_security_group_ingress' do
14
14
  end
15
15
 
16
16
  after(:each) do
17
- ec2.delete_security_group('fog_security_group')
17
+ AWS[:ec2].delete_security_group('fog_security_group')
18
18
  end
19
19
 
20
20
  it "should return proper attributes" do
21
- actual = ec2.revoke_security_group_ingress({
21
+ actual = AWS[:ec2].revoke_security_group_ingress({
22
22
  'FromPort' => 80,
23
23
  'GroupName' => 'fog_security_group',
24
24
  'IpProtocol' => 'tcp',
@@ -4,12 +4,12 @@ describe 'EC2.run_instances' do
4
4
  describe 'success' do
5
5
 
6
6
  after(:each) do
7
- ec2.terminate_instances(@instance_id)
7
+ AWS[:ec2].terminate_instances(@instance_id)
8
8
  end
9
9
 
10
10
  it "should return proper attributes" do
11
11
  # ami-5ee70037 = gentoo
12
- actual = ec2.run_instances(GENTOO_AMI, 1, 1)
12
+ actual = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1)
13
13
  @instance_id = actual.body['instancesSet'].first['instanceId']
14
14
  actual.body['groupSet'].should be_an(Array)
15
15
  actual.body['groupSet'].first.should be_a(String)
@@ -4,11 +4,11 @@ describe 'EC2.terminate_instances' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- @instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
7
+ @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
8
8
  end
9
9
 
10
10
  it "should return proper attributes" do
11
- actual = ec2.terminate_instances(@instance_id)
11
+ actual = AWS[:ec2].terminate_instances(@instance_id)
12
12
  actual.body['requestId'].should be_a(String)
13
13
  actual.body['instancesSet'].should be_an(Array)
14
14
  instance = actual.body['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
@@ -16,10 +16,10 @@ describe 'EC2.terminate_instances' do
16
16
  previous_state = instance['previousState']
17
17
  previous_state['code'].should be_a(Integer)
18
18
  previous_state['name'].should be_a(String)
19
- instance['shutdownState'].should be_a(Hash)
20
- shutdown_state = instance['shutdownState']
21
- shutdown_state['code'].should be_a(Integer)
22
- shutdown_state['name'].should be_a(String)
19
+ instance['currentState'].should be_a(Hash)
20
+ current_state = instance['currentState']
21
+ current_state['code'].should be_a(Integer)
22
+ current_state['name'].should be_a(String)
23
23
  end
24
24
 
25
25
  end
@@ -27,7 +27,7 @@ describe 'EC2.terminate_instances' do
27
27
 
28
28
  it 'should raise a BadRequest error if the instance does not exist' do
29
29
  lambda {
30
- ec2.terminate_instances('i-00000000')
30
+ AWS[:ec2].terminate_instances('i-00000000')
31
31
  }.should raise_error(Excon::Errors::BadRequest)
32
32
  end
33
33
 
@@ -4,20 +4,20 @@ describe 'S3.copy_object' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- s3.put_bucket('fogcopyobjectsource')
8
- s3.put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
9
- s3.put_bucket('fogcopyobjectdestination')
7
+ AWS[:s3].put_bucket('fogcopyobjectsource')
8
+ AWS[:s3].put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
9
+ AWS[:s3].put_bucket('fogcopyobjectdestination')
10
10
  end
11
11
 
12
12
  after(:each) do
13
- s3.delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
14
- s3.delete_bucket('fogcopyobjectdestination')
15
- s3.delete_object('fogcopyobjectsource', 'fog_copy_object_source')
16
- s3.delete_bucket('fogcopyobjectsource')
13
+ AWS[:s3].delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
14
+ AWS[:s3].delete_bucket('fogcopyobjectdestination')
15
+ AWS[:s3].delete_object('fogcopyobjectsource', 'fog_copy_object_source')
16
+ AWS[:s3].delete_bucket('fogcopyobjectsource')
17
17
  end
18
18
 
19
19
  it 'should return proper attributes' do
20
- actual = s3.copy_object(
20
+ actual = AWS[:s3].copy_object(
21
21
  'fogcopyobjectsource', 'fog_copy_object_source',
22
22
  'fogcopyobjectdestination', 'fog_copy_object_destination'
23
23
  )
@@ -31,7 +31,7 @@ describe 'S3.copy_object' do
31
31
 
32
32
  it 'should raise a NotFound error if the source_bucket does not exist' do
33
33
  lambda {
34
- s3.copy_object(
34
+ AWS[:s3].copy_object(
35
35
  'fognotabucket', 'fog_copy_object_source',
36
36
  'fogcopyobjectdestination', 'fog_copy_object_destination'
37
37
  )
@@ -40,7 +40,7 @@ describe 'S3.copy_object' do
40
40
 
41
41
  it 'should raise a NotFound error if the source_object does not exist' do
42
42
  lambda {
43
- s3.copy_object(
43
+ AWS[:s3].copy_object(
44
44
  'fogcopyobjectsource', 'fog_not_an_object',
45
45
  'fogcopyobjectdestination', 'fog_copy_object_destination'
46
46
  )
@@ -49,7 +49,7 @@ describe 'S3.copy_object' do
49
49
 
50
50
  it 'should raise a NotFound error if the target_bucket does not exist' do
51
51
  lambda {
52
- s3.copy_object(
52
+ AWS[:s3].copy_object(
53
53
  'fogcopyobjectsource', 'fog_copy_object_source',
54
54
  'fognotabucket', 'fog_copy_object_destination'
55
55
  )
@@ -4,11 +4,11 @@ describe 'S3.delete_bucket' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- s3.put_bucket('fogdeletebucket')
7
+ AWS[:s3].put_bucket('fogdeletebucket')
8
8
  end
9
9
 
10
10
  it 'should return proper attributes' do
11
- actual = s3.delete_bucket('fogdeletebucket')
11
+ actual = AWS[:s3].delete_bucket('fogdeletebucket')
12
12
  actual.status.should == 204
13
13
  end
14
14
 
@@ -17,18 +17,18 @@ describe 'S3.delete_bucket' do
17
17
 
18
18
  it 'should raise a NotFound error if the bucket does not exist' do
19
19
  lambda {
20
- s3.delete_bucket('fognotabucket')
20
+ AWS[:s3].delete_bucket('fognotabucket')
21
21
  }.should raise_error(Excon::Errors::NotFound)
22
22
  end
23
23
 
24
24
  it 'should raise a Conflict error if the bucket is not empty' do
25
- s3.put_bucket('fogdeletebucket')
26
- s3.put_object('fogdeletebucket', 'fog_delete_object', lorem_file)
25
+ AWS[:s3].put_bucket('fogdeletebucket')
26
+ AWS[:s3].put_object('fogdeletebucket', 'fog_delete_object', lorem_file)
27
27
  lambda {
28
- s3.delete_bucket('fogdeletebucket')
28
+ AWS[:s3].delete_bucket('fogdeletebucket')
29
29
  }.should raise_error(Excon::Errors::Conflict)
30
- s3.delete_object('fogdeletebucket', 'fog_delete_object')
31
- s3.delete_bucket('fogdeletebucket')
30
+ AWS[:s3].delete_object('fogdeletebucket', 'fog_delete_object')
31
+ AWS[:s3].delete_bucket('fogdeletebucket')
32
32
  end
33
33
 
34
34
  end
@@ -4,16 +4,16 @@ describe 'S3.delete_object' do
4
4
  describe 'success' do
5
5
 
6
6
  before(:each) do
7
- s3.put_bucket('fogdeleteobject')
8
- s3.put_object('fogdeleteobject', 'fog_delete_object', lorem_file)
7
+ AWS[:s3].put_bucket('fogdeleteobject')
8
+ AWS[:s3].put_object('fogdeleteobject', 'fog_delete_object', lorem_file)
9
9
  end
10
10
 
11
11
  after(:each) do
12
- s3.delete_bucket('fogdeleteobject')
12
+ AWS[:s3].delete_bucket('fogdeleteobject')
13
13
  end
14
14
 
15
15
  it 'should return proper attributes' do
16
- actual = s3.delete_object('fogdeleteobject', 'fog_delete_object')
16
+ actual = AWS[:s3].delete_object('fogdeleteobject', 'fog_delete_object')
17
17
  actual.status.should == 204
18
18
  end
19
19
 
@@ -22,14 +22,14 @@ describe 'S3.delete_object' do
22
22
 
23
23
  it 'should raise a NotFound error if the bucket does not exist' do
24
24
  lambda {
25
- s3.delete_object('fognotabucket', 'fog_delete_object')
25
+ AWS[:s3].delete_object('fognotabucket', 'fog_delete_object')
26
26
  }.should raise_error(Excon::Errors::NotFound)
27
27
  end
28
28
 
29
29
  it 'should not raise an error if the object does not exist' do
30
- s3.put_bucket('fogdeleteobject')
31
- s3.delete_object('fogdeleteobject', 'fog_not_an_object')
32
- s3.delete_bucket('fogdeleteobject')
30
+ AWS[:s3].put_bucket('fogdeleteobject')
31
+ AWS[:s3].delete_object('fogdeleteobject', 'fog_not_an_object')
32
+ AWS[:s3].delete_bucket('fogdeleteobject')
33
33
  end
34
34
 
35
35
  end