Sha256: 3d4abb09c178d63cf826247b42cfc543e1c105f386e73ac2d101690f407015a9
Contents?: true
Size: 1.26 KB
Versions: 37
Compression:
Stored size: 1.26 KB
Contents
require 'helper' class SomeS3Consumer include S3 end class S3Test < Vault::TestCase include LoggedDataHelper def setup super set_env 'APP_DEPLOY', 'test' set_env 'AWS_ACCESS_KEY_ID', 'fake access key id' set_env 'AWS_SECRET_ACCESS_KEY', 'fake secret access key' AWS.stub! @consumer = SomeS3Consumer.new end def log_output Scrolls.stream.string end # S3 writes should be logged. def test_write_logs @consumer.write('fake bucket', 'fake key', 'fake value') assert_match /fake key/, log_output end # S3 reads should be logged. def test_read_logs @consumer.read('fake bucket', 'fake key') assert_match /fake key/, log_output end # Should use S3 to write to bucket def test_writes_to_s3_bucket mock(@consumer).s3.mock!.buckets. mock!.[]('fake bucket'). mock!.objects. mock!.[]('fake key'). mock!.write('fake value') @consumer.write('fake bucket', 'fake key', 'fake value') end # Should use S3 to read from bucket def test_reads_from_s3_bucket #s3.buckets[bucket].objects[key].read mock(@consumer).s3.mock!.buckets. mock!.[]('fake bucket'). mock!.objects. mock!.[]('fake key'). mock!.read @consumer.read('fake bucket', 'fake key') end end
Version data entries
37 entries across 37 versions & 1 rubygems