Sha256: bcc896dbe54cae7b51712c9b69d4709f60d28df0bdf3cb2eb677aba57d6f04c1
Contents?: true
Size: 1.75 KB
Versions: 4
Compression:
Stored size: 1.75 KB
Contents
require File.dirname(__FILE__) + '/test_helper' class BucketTest < Test::Unit::TestCase def test_bucket_name_validation valid_names = %w(123 joe step-one step_two step3 step_4 step-5) invalid_names = ['12', 'jo', 'kevin spacey', 'larry@wall', '', 'a' * 256] validate_name = Proc.new {|name| Bucket.send(:validate_name!, name)} valid_names.each do |valid_name| assert_nothing_raised { validate_name[valid_name] } end invalid_names.each do |invalid_name| assert_raises(InvalidBucketName) { validate_name[invalid_name] } end end def test_empty_bucket Bucket.request_always_returns :body => Fixtures::Buckets.empty_bucket, :code => 200 do bucket = Bucket.find('marcel_molina') assert bucket.empty? end end def test_bucket_with_one_file Bucket.request_always_returns :body => Fixtures::Buckets.bucket_with_one_key, :code => 200 do bucket = Bucket.find('marcel_molina') assert !bucket.empty? assert_equal 1, bucket.size assert_equal %w(tongue_overload.jpg), bucket.objects.map {|object| object.key} assert bucket['tongue_overload.jpg'] end end def test_bucket_with_more_than_one_file Bucket.request_always_returns :body => Fixtures::Buckets.bucket_with_more_than_one_key, :code => 200 do bucket = Bucket.find('marcel_molina') assert !bucket.empty? assert_equal 2, bucket.size assert_equal %w(beluga_baby.jpg tongue_overload.jpg), bucket.objects.map {|object| object.key}.sort assert bucket['tongue_overload.jpg'] end end def test_bucket_path assert_equal '/bucket_name?max-keys=2', Bucket.send(:path, 'bucket_name', :max_keys => 2) assert_equal '/bucket_name', Bucket.send(:path, 'bucket_name', {}) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
aws-s3-0.1.0 | test/bucket_test.rb |
aws-s3-0.1.2 | test/bucket_test.rb |
aws-s3-0.2.0 | test/bucket_test.rb |
aws-s3-0.1.1 | test/bucket_test.rb |