fog 0.0.39 → 0.0.40
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +88 -31
- data/Rakefile +25 -2
- data/VERSION +1 -1
- data/bin/fog +57 -43
- data/fog.gemspec +52 -23
- data/lib/fog.rb +7 -4
- data/lib/fog/aws/ec2.rb +6 -2
- data/lib/fog/aws/models/ec2/address.rb +13 -13
- data/lib/fog/aws/models/ec2/addresses.rb +5 -5
- data/lib/fog/aws/models/ec2/flavor.rb +19 -0
- data/lib/fog/aws/models/ec2/flavors.rb +43 -0
- data/lib/fog/aws/models/ec2/image.rb +24 -0
- data/lib/fog/aws/models/ec2/images.rb +44 -0
- data/lib/fog/aws/models/ec2/{instance.rb → server.rb} +22 -10
- data/lib/fog/aws/models/ec2/{instances.rb → servers.rb} +12 -12
- data/lib/fog/aws/models/ec2/snapshot.rb +2 -2
- data/lib/fog/aws/models/ec2/volume.rb +17 -17
- data/lib/fog/aws/models/ec2/volumes.rb +5 -5
- data/lib/fog/aws/models/s3/{buckets.rb → directories.rb} +16 -13
- data/lib/fog/aws/models/s3/{bucket.rb → directory.rb} +5 -10
- data/lib/fog/aws/models/s3/{object.rb → file.rb} +16 -18
- data/lib/fog/aws/models/s3/{objects.rb → files.rb} +19 -19
- data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
- data/lib/fog/aws/s3.rb +6 -6
- data/lib/fog/rackspace/files.rb +6 -3
- data/lib/fog/rackspace/models/servers/flavor.rb +26 -1
- data/lib/fog/rackspace/models/servers/image.rb +3 -3
- data/lib/fog/rackspace/models/servers/server.rb +20 -9
- data/lib/fog/rackspace/models/servers/servers.rb +3 -1
- data/lib/fog/rackspace/servers.rb +2 -1
- data/spec/aws/models/ec2/address_spec.rb +8 -8
- data/spec/aws/models/ec2/server_spec.rb +109 -0
- data/spec/aws/models/ec2/servers_spec.rb +52 -0
- data/spec/aws/models/ec2/snapshot_spec.rb +2 -1
- data/spec/aws/models/ec2/volume_spec.rb +22 -22
- data/spec/aws/models/s3/directories_spec.rb +49 -0
- data/spec/aws/models/s3/directory_spec.rb +112 -0
- data/spec/aws/models/s3/file_spec.rb +106 -0
- data/spec/aws/models/s3/files_spec.rb +116 -0
- data/spec/rackspace/models/servers/server_spec.rb +51 -0
- data/spec/shared_examples/server_examples.rb +42 -0
- data/spec/spec_helper.rb +1 -1
- metadata +51 -22
- data/spec/aws/models/ec2/instance_spec.rb +0 -161
- data/spec/aws/models/ec2/instances_spec.rb +0 -70
- data/spec/aws/models/s3/bucket_spec.rb +0 -129
- data/spec/aws/models/s3/buckets_spec.rb +0 -70
- data/spec/aws/models/s3/object_spec.rb +0 -121
- data/spec/aws/models/s3/objects_spec.rb +0 -141
@@ -1,161 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Fog::AWS::EC2::Instance' do
|
4
|
-
|
5
|
-
describe "#initialize" do
|
6
|
-
|
7
|
-
it "should remap attributes from parser" do
|
8
|
-
instance = ec2.instances.new({
|
9
|
-
'amiLaunchIndex' => 'ami_launch_index',
|
10
|
-
'dnsName' => 'dns_name',
|
11
|
-
'groupId' => 'group_id',
|
12
|
-
'imageId' => 'image_id',
|
13
|
-
'instanceId' => 'instance_id',
|
14
|
-
'instanceType' => 'instance_type',
|
15
|
-
'kernelId' => 'kernel_id',
|
16
|
-
'keyName' => 'key_name',
|
17
|
-
'launchTime' => 'launch_time',
|
18
|
-
'productCodes' => 'product_codes',
|
19
|
-
'privateDnsName' => 'private_dns_name',
|
20
|
-
'ramdiskId' => 'ramdisk_id'
|
21
|
-
})
|
22
|
-
instance.ami_launch_index.should == 'ami_launch_index'
|
23
|
-
instance.dns_name.should == 'dns_name'
|
24
|
-
instance.group_id.should == 'group_id'
|
25
|
-
instance.image_id.should == 'image_id'
|
26
|
-
instance.id.should == 'instance_id'
|
27
|
-
instance.type.should == 'instance_type'
|
28
|
-
instance.kernel_id.should == 'kernel_id'
|
29
|
-
instance.key_name.should == 'key_name'
|
30
|
-
instance.launch_time.should == 'launch_time'
|
31
|
-
instance.product_codes.should == 'product_codes'
|
32
|
-
instance.private_dns_name.should == 'private_dns_name'
|
33
|
-
instance.ramdisk_id.should == 'ramdisk_id'
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#addresses" do
|
39
|
-
|
40
|
-
it "should return a Fog::AWS::EC2::Addresses" do
|
41
|
-
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
42
|
-
instance.addresses.should be_a(Fog::AWS::EC2::Addresses)
|
43
|
-
instance.destroy
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "#destroy" do
|
49
|
-
|
50
|
-
it "should return true if the instance is deleted" do
|
51
|
-
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
52
|
-
instance.destroy.should be_true
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "#state" do
|
58
|
-
it "should remap values out of hash" do
|
59
|
-
instance = Fog::AWS::EC2::Instance.new({
|
60
|
-
'instanceState' => { 'name' => 'instance_state' },
|
61
|
-
})
|
62
|
-
instance.state.should == 'instance_state'
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "#collection" do
|
67
|
-
|
68
|
-
it "should return a Fog::AWS::EC2::Instances" do
|
69
|
-
ec2.instances.new.collection.should be_a(Fog::AWS::EC2::Instances)
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should be the instances the instance is related to" do
|
73
|
-
instances = ec2.instances
|
74
|
-
instances.new.collection.should == instances
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "#key_pair" do
|
80
|
-
it "should have tests"
|
81
|
-
end
|
82
|
-
|
83
|
-
describe "#key_pair=" do
|
84
|
-
it "should have tests"
|
85
|
-
end
|
86
|
-
|
87
|
-
describe "#monitoring=" do
|
88
|
-
it "should remap values out of hash" do
|
89
|
-
instance = Fog::AWS::EC2::Instance.new({
|
90
|
-
'monitoring' => { 'state' => true }
|
91
|
-
})
|
92
|
-
instance.monitoring.should == true
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe "#placement=" do
|
97
|
-
|
98
|
-
it "should remap values into availability_zone" do
|
99
|
-
instance = Fog::AWS::EC2::Instance.new({
|
100
|
-
'placement' => { 'availabilityZone' => 'availability_zone' }
|
101
|
-
})
|
102
|
-
instance.availability_zone.should == 'availability_zone'
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "#reload" do
|
108
|
-
|
109
|
-
before(:each) do
|
110
|
-
@instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
111
|
-
@reloaded = @instance.reload
|
112
|
-
end
|
113
|
-
|
114
|
-
after(:each) do
|
115
|
-
@instance.destroy
|
116
|
-
end
|
117
|
-
|
118
|
-
it "should return a Fog::AWS::EC2::Instance" do
|
119
|
-
@reloaded.should be_a(Fog::AWS::EC2::Instance)
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should reset attributes to remote state" do
|
123
|
-
@instance.attributes.should == @reloaded.attributes
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "#save" do
|
129
|
-
|
130
|
-
before(:each) do
|
131
|
-
@instance = ec2.instances.new(:image_id => GENTOO_AMI)
|
132
|
-
end
|
133
|
-
|
134
|
-
it "should return true when it succeeds" do
|
135
|
-
@instance.save.should be_true
|
136
|
-
@instance.destroy
|
137
|
-
end
|
138
|
-
|
139
|
-
it "should not exist in instances before save" do
|
140
|
-
ec2.instances.get(@instance.id).should be_nil
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should exist in buckets after save" do
|
144
|
-
@instance.save
|
145
|
-
ec2.instances.get(@instance.id).should_not be_nil
|
146
|
-
@instance.destroy
|
147
|
-
end
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
describe "#volumes" do
|
152
|
-
|
153
|
-
it "should return a Fog::AWS::EC2::Volumes" do
|
154
|
-
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
155
|
-
instance.volumes.should be_a(Fog::AWS::EC2::Volumes)
|
156
|
-
instance.destroy
|
157
|
-
end
|
158
|
-
|
159
|
-
end
|
160
|
-
|
161
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Fog::AWS::EC2::Instances' do
|
4
|
-
|
5
|
-
describe "#all" do
|
6
|
-
|
7
|
-
it "should return a Fog::AWS::EC2::Instances" do
|
8
|
-
ec2.instances.all.should be_a(Fog::AWS::EC2::Instances)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should include persisted instances" do
|
12
|
-
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
13
|
-
ec2.instances.get(instance.id).should_not be_nil
|
14
|
-
instance.destroy
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#create" do
|
20
|
-
|
21
|
-
before(:each) do
|
22
|
-
@instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
23
|
-
end
|
24
|
-
|
25
|
-
after(:each) do
|
26
|
-
@instance.destroy
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should return a Fog::AWS::EC2::Instance" do
|
30
|
-
@instance.should be_a(Fog::AWS::EC2::Instance)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should exist on ec2" do
|
34
|
-
ec2.instances.get(@instance.id).should_not be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#get" do
|
40
|
-
|
41
|
-
it "should return a Fog::AWS::EC2::Instance if a matching instance exists" do
|
42
|
-
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
43
|
-
get = ec2.instances.get(instance.id)
|
44
|
-
instance.attributes.should == get.attributes
|
45
|
-
instance.destroy
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should return nil if no matching instance exists" do
|
49
|
-
ec2.instances.get('i-00000000').should be_nil
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#new" do
|
55
|
-
|
56
|
-
it "should return a Fog::AWS::EC2::Instance" do
|
57
|
-
ec2.instances.new(:image_id => GENTOO_AMI).should be_a(Fog::AWS::EC2::Instance)
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#reload" do
|
63
|
-
|
64
|
-
it "should return a Fog::AWS::EC2::Instances" do
|
65
|
-
ec2.instances.all.reload.should be_a(Fog::AWS::EC2::Instances)
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Fog::AWS::S3::Bucket' do
|
4
|
-
|
5
|
-
describe "#initialize" do
|
6
|
-
|
7
|
-
it "should remap attributes from parser" do
|
8
|
-
now = Time.now
|
9
|
-
bucket = Fog::AWS::S3::Bucket.new(
|
10
|
-
'CreationDate' => now,
|
11
|
-
'Name' => 'bucketname'
|
12
|
-
)
|
13
|
-
bucket.creation_date.should == now
|
14
|
-
bucket.name.should == 'bucketname'
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#collection" do
|
20
|
-
|
21
|
-
it "should return a Fog::AWS::S3::Buckets" do
|
22
|
-
s3.buckets.new.collection.should be_a(Fog::AWS::S3::Buckets)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should be the buckets the bucket is related to" do
|
26
|
-
buckets = s3.buckets
|
27
|
-
buckets.new.collection.should == buckets
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "#destroy" do
|
33
|
-
|
34
|
-
it "should return true if the bucket is deleted" do
|
35
|
-
bucket = s3.buckets.create(:name => 'fogmodelbucket')
|
36
|
-
bucket.destroy.should be_true
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should return false if the bucket does not exist" do
|
40
|
-
bucket = s3.buckets.new(:name => 'fogmodelbucket')
|
41
|
-
bucket.destroy.should be_false
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "#location" do
|
47
|
-
|
48
|
-
it "should return the location constraint" do
|
49
|
-
bucket = s3.buckets.create(:name => 'fogmodeleubucket', :location => 'EU')
|
50
|
-
bucket.location.should == 'EU'
|
51
|
-
eu_s3.buckets.new(:name => 'fogmodeleubucket').destroy
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "#objects" do
|
57
|
-
|
58
|
-
it "should return a Fog::AWS::S3::Objects" do
|
59
|
-
bucket = s3.buckets.new(:name => 'fogmodelbucket')
|
60
|
-
bucket.objects.should be_an(Fog::AWS::S3::Objects)
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "#payer" do
|
66
|
-
|
67
|
-
it "should return the request payment value" do
|
68
|
-
bucket = s3.buckets.create(:name => 'fogmodelbucket')
|
69
|
-
bucket.payer.should == 'BucketOwner'
|
70
|
-
bucket.destroy.should be_true
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "#payer=" do
|
76
|
-
|
77
|
-
it "should set the request payment value" do
|
78
|
-
bucket = s3.buckets.create(:name => 'fogmodelbucket')
|
79
|
-
(bucket.payer = 'Requester').should == 'Requester'
|
80
|
-
bucket.destroy.should
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
describe "#reload" do
|
86
|
-
|
87
|
-
before(:each) do
|
88
|
-
@bucket = s3.buckets.create(:name => 'fogmodelbucket')
|
89
|
-
@reloaded = @bucket.reload
|
90
|
-
end
|
91
|
-
|
92
|
-
after(:each) do
|
93
|
-
@bucket.destroy
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should return a Fog::AWS::S3::Bucket" do
|
97
|
-
@reloaded.should be_a(Fog::AWS::S3::Bucket)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should reset attributes to remote state" do
|
101
|
-
@bucket.attributes.should == @reloaded.attributes
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "#save" do
|
107
|
-
|
108
|
-
before(:each) do
|
109
|
-
@bucket = s3.buckets.new(:name => 'fogmodelbucket')
|
110
|
-
end
|
111
|
-
|
112
|
-
it "should return true when it succeeds" do
|
113
|
-
@bucket.save.should be_true
|
114
|
-
@bucket.destroy
|
115
|
-
end
|
116
|
-
|
117
|
-
it "should not exist in buckets before save" do
|
118
|
-
s3.buckets.all.map {|bucket| bucket.name}.include?(@bucket.name).should be_false
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should exist in buckets after save" do
|
122
|
-
@bucket.save
|
123
|
-
s3.buckets.all.map {|bucket| bucket.name}.include?(@bucket.name).should be_true
|
124
|
-
@bucket.destroy
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Fog::AWS::S3::Buckets' do
|
4
|
-
|
5
|
-
describe "#all" do
|
6
|
-
|
7
|
-
it "should return a Fog::AWS::S3::Buckets" do
|
8
|
-
s3.buckets.all.should be_a(Fog::AWS::S3::Buckets)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should include persisted buckets" do
|
12
|
-
bucket = s3.buckets.create(:name => 'fogbucketname')
|
13
|
-
s3.buckets.all.map {|bucket| bucket.name}.should include('fogbucketname')
|
14
|
-
bucket.destroy
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#create" do
|
20
|
-
|
21
|
-
before(:each) do
|
22
|
-
@bucket = s3.buckets.create(:name => 'fogbucketname')
|
23
|
-
end
|
24
|
-
|
25
|
-
after(:each) do
|
26
|
-
@bucket.destroy
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should return a Fog::AWS::S3::Bucket" do
|
30
|
-
@bucket.should be_a(Fog::AWS::S3::Bucket)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should exist on s3" do
|
34
|
-
s3.buckets.get(@bucket.name).should_not be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#get" do
|
40
|
-
|
41
|
-
it "should return a Fog::AWS::S3::Bucket if a matching bucket exists" do
|
42
|
-
bucket = s3.buckets.create(:name => 'fogbucketname')
|
43
|
-
get = s3.buckets.get('fogbucketname')
|
44
|
-
bucket.attributes.should == get.attributes
|
45
|
-
bucket.destroy
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should return nil if no matching bucket exists" do
|
49
|
-
s3.buckets.get('fogbucketname').should be_nil
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#new" do
|
55
|
-
|
56
|
-
it "should return a Fog::AWS::S3::Bucket" do
|
57
|
-
s3.buckets.new.should be_a(Fog::AWS::S3::Bucket)
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#reload" do
|
63
|
-
|
64
|
-
it "should return a Fog::AWS::S3::Buckets" do
|
65
|
-
s3.buckets.all.should be_a(Fog::AWS::S3::Buckets)
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
@@ -1,121 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'S3::Object' do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@bucket = s3.buckets.create(:name => 'fogbucketname')
|
7
|
-
end
|
8
|
-
|
9
|
-
after(:each) do
|
10
|
-
@bucket.destroy
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#initialize" do
|
14
|
-
|
15
|
-
it "should remap attributes from parser" do
|
16
|
-
now = Time.now
|
17
|
-
bucket = Fog::AWS::S3::Object.new(
|
18
|
-
'Content-Length' => 10,
|
19
|
-
'Content-Type' => 'contenttype',
|
20
|
-
'Etag' => 'etag',
|
21
|
-
'Key' => 'key',
|
22
|
-
'Last-Modified' => now,
|
23
|
-
'Size' => 10,
|
24
|
-
'StorageClass' => 'storageclass'
|
25
|
-
)
|
26
|
-
bucket.content_length == 10
|
27
|
-
bucket.content_type.should == 'contenttype'
|
28
|
-
bucket.etag.should == 'etag'
|
29
|
-
bucket.key.should == 'key'
|
30
|
-
bucket.last_modified.should == now
|
31
|
-
bucket.size.should == 10
|
32
|
-
bucket.storage_class.should == 'storageclass'
|
33
|
-
|
34
|
-
bucket = Fog::AWS::S3::Object.new(
|
35
|
-
'ETag' => 'etag',
|
36
|
-
'LastModified' => now
|
37
|
-
)
|
38
|
-
bucket.etag.should == 'etag'
|
39
|
-
bucket.last_modified.should == now
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "#bucket" do
|
45
|
-
|
46
|
-
before(:each) do
|
47
|
-
@object = @bucket.objects.new(:key => 'foo')
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
it "should return an S3::Bucket" do
|
52
|
-
@object.bucket.should be_a(Fog::AWS::S3::Bucket)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should be the bucket the object is related to" do
|
56
|
-
@object.bucket.should == @bucket
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "#copy" do
|
62
|
-
|
63
|
-
it "should return a Fog::AWS::S3::Object with matching attributes" do
|
64
|
-
other_bucket = s3.buckets.create(:name => 'fogotherbucketname')
|
65
|
-
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
66
|
-
object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
|
67
|
-
other_object = object.copy('fogotherbucketname', 'fogotherobjectname')
|
68
|
-
object.reload.attributes.reject{|key,value| [:key, :last_modified].include?(key)}.should == other_object.reload.attributes.reject{|key,value| [:key, :last_modified].include?(key)}
|
69
|
-
other_object.destroy
|
70
|
-
object.destroy
|
71
|
-
other_bucket.destroy
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "#destroy" do
|
77
|
-
|
78
|
-
it "should return true if the object is deleted" do
|
79
|
-
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
80
|
-
object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
|
81
|
-
object.destroy.should be_true
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should return true if the object does not exist" do
|
85
|
-
object = @bucket.objects.new(:key => 'fogobjectname')
|
86
|
-
object.destroy.should be_true
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
describe "#reload" do
|
92
|
-
|
93
|
-
it "should return a Fog::AWS::S3::Object" do
|
94
|
-
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
95
|
-
object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
|
96
|
-
# object.reload.should be_a(Fog::AWS::S3::Object)
|
97
|
-
object.destroy
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should reset attributes to remote state" do
|
101
|
-
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
102
|
-
object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
|
103
|
-
object.last_modified = Time.now
|
104
|
-
# object.reload.attributes.should == object.attributes
|
105
|
-
object.destroy
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "#save" do
|
111
|
-
|
112
|
-
it "should return the success value" do
|
113
|
-
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
114
|
-
object = @bucket.objects.new(:key => 'fogobjectname', :body => file)
|
115
|
-
object.save.should be_true
|
116
|
-
object.destroy
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|