From d3c6e44515112201a4c71514c458764095a693d4 Mon Sep 17 00:00:00 2001 From: Wesley Beary Date: Mon, 29 Jun 2009 22:23:14 -0700 Subject: [PATCH] more filling out the specs --- lib/fog/aws/s3/parsers.rb | 1 + spec/aws/s3/copy_object_spec.rb | 4 ++-- spec/aws/s3/delete_bucket_spec.rb | 2 -- spec/aws/s3/delete_object_spec.rb | 2 -- spec/aws/s3/get_object_spec.rb | 10 +++++++--- spec/aws/s3/head_object_spec.rb | 7 +++++-- spec/aws/s3/put_object_spec.rb | 2 -- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/fog/aws/s3/parsers.rb b/lib/fog/aws/s3/parsers.rb index 7299f5e5e..384e2707c 100644 --- a/lib/fog/aws/s3/parsers.rb +++ b/lib/fog/aws/s3/parsers.rb @@ -127,6 +127,7 @@ module Fog @response[:etag] = @value when 'LastModified' @response[:last_modified] = Time.parse(@value) + end end end diff --git a/spec/aws/s3/copy_object_spec.rb b/spec/aws/s3/copy_object_spec.rb index f40abd7b3..5bfeabd81 100644 --- a/spec/aws/s3/copy_object_spec.rb +++ b/spec/aws/s3/copy_object_spec.rb @@ -17,13 +17,13 @@ describe 'S3.copy_object' do end it 'should return proper attributes' do - p 'SHOULD CHECK FOR PROPER ATTRIBUTES' actual = s3.copy_object( 'fogcopyobjectsource', 'fog_copy_object_source', 'fogcopyobjectdestination', 'fog_copy_object_destination' ) actual.status.should == 200 - p actual + actual.body[:etag].should be_a(String) + actual.body[:last_modified].should be_a(Time) end end \ No newline at end of file diff --git a/spec/aws/s3/delete_bucket_spec.rb b/spec/aws/s3/delete_bucket_spec.rb index 3d216d413..5786f1092 100644 --- a/spec/aws/s3/delete_bucket_spec.rb +++ b/spec/aws/s3/delete_bucket_spec.rb @@ -11,10 +11,8 @@ describe 'S3.delete_bucket' do end it 'should return proper attributes' do - p 'SHOULD CHECK FOR PROPER ATTRIBUTES' actual = s3.delete_bucket('fogdeletebucket') actual.status.should == 204 - p actual end it 'should not include fogdeletebucket in get_service after delete_bucket' do diff --git a/spec/aws/s3/delete_object_spec.rb b/spec/aws/s3/delete_object_spec.rb index 02dc8e63c..a85bfed87 100644 --- a/spec/aws/s3/delete_object_spec.rb +++ b/spec/aws/s3/delete_object_spec.rb @@ -13,10 +13,8 @@ describe 'S3.delete_object' do end it 'should return proper attributes' do - p 'SHOULD CHECK FOR PROPER ATTRIBUTES' actual = s3.delete_object('fogdeleteobject', 'fog_delete_object') actual.status.should == 204 - p actual end end \ No newline at end of file diff --git a/spec/aws/s3/get_object_spec.rb b/spec/aws/s3/get_object_spec.rb index 2d8ac7c18..74bc07425 100644 --- a/spec/aws/s3/get_object_spec.rb +++ b/spec/aws/s3/get_object_spec.rb @@ -14,10 +14,14 @@ describe 'S3.get_object' do end it 'should return proper attributes' do - p 'SHOULD CHECK FOR PROPER ATTRIBUTES' actual = s3.get_object('foggetobject', 'fog_get_object') actual.status.should == 200 - p actual + file = File.open(File.dirname(__FILE__) + '/../../lorem.txt', 'r') + data = file.read + actual.body.should == data + actual.headers['Content-Length'].should == data.length.to_s + actual.headers['ETag'].should be_a(String) + actual.headers['Last-Modified'].should be_a(String) end -end \ No newline at end of file +end diff --git a/spec/aws/s3/head_object_spec.rb b/spec/aws/s3/head_object_spec.rb index d8210a73b..3e3dab8d0 100644 --- a/spec/aws/s3/head_object_spec.rb +++ b/spec/aws/s3/head_object_spec.rb @@ -14,10 +14,13 @@ describe 'S3.head_object' do end it 'should return proper attributes' do - p 'SHOULD CHECK FOR PROPER ATTRIBUTES' actual = s3.head_object('fogheadobject', 'fog_head_object') actual.status.should == 200 - p actual + file = File.open(File.dirname(__FILE__) + '/../../lorem.txt', 'r') + data = file.read + actual.headers['Content-Length'].should == data.length.to_s + actual.headers['ETag'].should be_a(String) + actual.headers['Last-Modified'].should be_a(String) end end \ No newline at end of file diff --git a/spec/aws/s3/put_object_spec.rb b/spec/aws/s3/put_object_spec.rb index 1858fdb10..44fc0a919 100644 --- a/spec/aws/s3/put_object_spec.rb +++ b/spec/aws/s3/put_object_spec.rb @@ -12,11 +12,9 @@ describe 'S3.put_object' do end it 'should return proper attributes' do - p 'SHOULD CHECK FOR PROPER ATTRIBUTES' file = File.open(File.dirname(__FILE__) + '/../../lorem.txt', 'r') actual = s3.put_object('fogputobject', 'fog_put_object', file) actual.status.should == 200 - p actual end end \ No newline at end of file