asset_cloud 2.5.3 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,46 +1,44 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  require 'spec_helper'
3
4
 
4
-
5
5
  class FindFreeKey
6
6
  extend AssetCloud::FreeKeyLocator
7
7
  end
8
8
 
9
9
  describe "FreeFilenameLocator", 'when asked to return a free key such as the one passed in' do
10
-
11
10
  it "should simply return the key if it happens to be free" do
12
- FindFreeKey.should_receive(:exist?).with('free.txt').and_return(false)
11
+ expect(FindFreeKey).to(receive(:exist?).with('free.txt').and_return(false))
13
12
 
14
- FindFreeKey.find_free_key_like('free.txt').should == 'free.txt'
13
+ expect(FindFreeKey.find_free_key_like('free.txt')).to(eq('free.txt'))
15
14
  end
16
15
 
17
16
  it "should append a UUID to the key before the extension if key is taken" do
18
- SecureRandom.stub(:uuid).and_return('moo')
19
- FindFreeKey.should_receive(:exist?).with('free.txt').and_return(true)
20
- FindFreeKey.should_receive(:exist?).with('free_moo.txt').and_return(false)
17
+ allow(SecureRandom).to(receive(:uuid).and_return('moo'))
18
+ expect(FindFreeKey).to(receive(:exist?).with('free.txt').and_return(true))
19
+ expect(FindFreeKey).to(receive(:exist?).with('free_moo.txt').and_return(false))
21
20
 
22
- FindFreeKey.find_free_key_like('free.txt').should == 'free_moo.txt'
21
+ expect(FindFreeKey.find_free_key_like('free.txt')).to(eq('free_moo.txt'))
23
22
  end
24
23
 
25
-
26
24
  it "should not strip any directory information from the key" do
27
- SecureRandom.stub(:uuid).and_return('moo')
28
- FindFreeKey.should_receive(:exist?).with('products/images/image.gif').and_return(true)
29
- FindFreeKey.should_receive(:exist?).with('products/images/image_moo.gif').and_return(false)
25
+ allow(SecureRandom).to(receive(:uuid).and_return('moo'))
26
+ expect(FindFreeKey).to(receive(:exist?).with('products/images/image.gif').and_return(true))
27
+ expect(FindFreeKey).to(receive(:exist?).with('products/images/image_moo.gif').and_return(false))
30
28
 
31
- FindFreeKey.find_free_key_like('products/images/image.gif').should == 'products/images/image_moo.gif'
29
+ expect(FindFreeKey.find_free_key_like('products/images/image.gif')).to(eq('products/images/image_moo.gif'))
32
30
  end
33
31
 
34
32
  it "should raise an exception if the randomly chosen value (after 10 attempts) is also taken" do
35
- FindFreeKey.stub(:exist?).and_return(true)
36
- lambda { FindFreeKey.find_free_key_like('free.txt') }.should raise_error(StandardError)
33
+ allow(FindFreeKey).to(receive(:exist?).and_return(true))
34
+ expect { FindFreeKey.find_free_key_like('free.txt') }.to(raise_error(StandardError))
37
35
  end
38
36
 
39
37
  it "should append a UUID to the key before the extensions if the force_uuid option is passed" do
40
- FindFreeKey.should_receive(:exist?).with('free.txt').and_return(false)
41
- FindFreeKey.should_receive(:exist?).with('free_as-in-beer.txt').and_return(false)
42
- SecureRandom.stub(:uuid).and_return('as-in-beer')
38
+ expect(FindFreeKey).to(receive(:exist?).with('free.txt').and_return(false))
39
+ expect(FindFreeKey).to(receive(:exist?).with('free_as-in-beer.txt').and_return(false))
40
+ allow(SecureRandom).to(receive(:uuid).and_return('as-in-beer'))
43
41
 
44
- FindFreeKey.find_free_key_like('free.txt', :force_uuid => true).should == 'free_as-in-beer.txt'
42
+ expect(FindFreeKey.find_free_key_like('free.txt', force_uuid: true)).to(eq('free_as-in-beer.txt'))
45
43
  end
46
44
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # rubocop:disable RSpec/FilePath, Lint/MissingCopEnableDirective
3
2
 
4
3
  require 'spec_helper'
5
4
  require 'google/cloud/storage'
@@ -20,9 +19,9 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
20
19
  @cloud = RemoteGCSCloud.new(directory, 'assets/files')
21
20
 
22
21
  @cloud.gcs_connection = Google::Cloud::Storage.new(
23
- project_id: ENV['GCS_PROJECT_ID'],
24
- credentials: ENV['GCS_KEY_FILEPATH']
25
- )
22
+ project_id: ENV['GCS_PROJECT_ID'],
23
+ credentials: ENV['GCS_KEY_FILEPATH']
24
+ )
26
25
  @bucket = @cloud.buckets[:tmp]
27
26
  end
28
27
 
@@ -31,10 +30,10 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
31
30
  end
32
31
 
33
32
  it "#ls with no arguments returns all files in the bucket" do
34
- expect_any_instance_of(Google::Cloud::Storage::Bucket).to receive(:files).with(no_args)
33
+ expect_any_instance_of(Google::Cloud::Storage::Bucket).to(receive(:files).with(no_args))
35
34
  expect do
36
35
  @bucket.ls
37
- end.not_to raise_error
36
+ end.not_to(raise_error)
38
37
  end
39
38
 
40
39
  it "#ls with arguments returns the file" do
@@ -44,7 +43,7 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
44
43
  @bucket.write(key, local_path)
45
44
 
46
45
  file = @bucket.ls(key)
47
- expect(file.name).to eq("s#{@cloud.url}/#{key}")
46
+ expect(file.name).to(eq("s#{@cloud.url}/#{key}"))
48
47
  end
49
48
 
50
49
  it "#write writes a file into the bucket" do
@@ -58,11 +57,11 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
58
57
  local_path = "#{directory}/products/key.txt"
59
58
  key = 'test/key.txt'
60
59
  metadata = {
61
- "X-Robots-Tag" => "none"
60
+ "X-Robots-Tag" => "none",
62
61
  }
63
62
 
64
63
  file = @bucket.write(key, local_path, metadata: metadata)
65
- expect(file.metadata).to eq(metadata)
64
+ expect(file.metadata).to(eq(metadata))
66
65
  end
67
66
 
68
67
  it "#write writes a file into the bucket with acl" do
@@ -71,7 +70,7 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
71
70
  acl = 'public'
72
71
 
73
72
  file = @bucket.write(key, local_path, acl: acl)
74
- expect(file.acl).to be_truthy
73
+ expect(file.acl).to(be_truthy)
75
74
  end
76
75
 
77
76
  it "#write writes a file into the bucket with content_disposition" do
@@ -80,7 +79,7 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
80
79
  content_disposition = 'attachment'
81
80
 
82
81
  file = @bucket.write(key, local_path, content_disposition: content_disposition)
83
- expect(file.content_disposition).to eq(content_disposition)
82
+ expect(file.content_disposition).to(eq(content_disposition))
84
83
  end
85
84
 
86
85
  it "#delete removes the file from the bucket" do
@@ -88,14 +87,14 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
88
87
 
89
88
  expect do
90
89
  @bucket.delete(key)
91
- end.not_to raise_error
90
+ end.not_to(raise_error)
92
91
  end
93
92
 
94
93
  it "#delete raises AssetCloud::AssetNotFoundError if the file is not found" do
95
94
  key = 'tmp/not_found.txt'
96
95
  expect do
97
96
  @bucket.delete(key)
98
- end.to raise_error(AssetCloud::AssetNotFoundError)
97
+ end.to(raise_error(AssetCloud::AssetNotFoundError))
99
98
  end
100
99
 
101
100
  it "#read returns the data of the file" do
@@ -104,14 +103,14 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
104
103
  @bucket.write(key, StringIO.new(value))
105
104
 
106
105
  data = @bucket.read(key)
107
- data.should == value
106
+ expect(data).to(eq(value))
108
107
  end
109
108
 
110
109
  it "#read raises AssetCloud::AssetNotFoundError if the file is not found" do
111
110
  key = 'tmp/not_found.txt'
112
111
  expect do
113
112
  @bucket.read(key)
114
- end.to raise_error(AssetCloud::AssetNotFoundError)
113
+ end.to(raise_error(AssetCloud::AssetNotFoundError))
115
114
  end
116
115
 
117
116
  it "#stats returns metadata of the asset" do
@@ -121,8 +120,8 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
121
120
 
122
121
  stats = @bucket.stat(key)
123
122
 
124
- expect(stats.size).not_to be_nil
125
- expect(stats.created_at).not_to be_nil
126
- expect(stats.updated_at).not_to be_nil
123
+ expect(stats.size).not_to(be_nil)
124
+ expect(stats.created_at).not_to(be_nil)
125
+ expect(stats.updated_at).not_to(be_nil)
127
126
  end
128
- end
127
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'google/cloud/storage'
3
4
 
@@ -24,27 +25,27 @@ describe AssetCloud::GCSBucket do
24
25
  end
25
26
 
26
27
  it "#ls with no arguments returns all files in the bucket" do
27
- expect_any_instance_of(GCSCloud).to receive(:gcs_bucket).and_return(@bucket)
28
- expect_any_instance_of(MockGCSBucket).to receive(:files).with(no_args).and_return(nil)
28
+ expect_any_instance_of(GCSCloud).to(receive(:gcs_bucket).and_return(@bucket))
29
+ expect_any_instance_of(MockGCSBucket).to(receive(:files).with(no_args).and_return(nil))
29
30
  @bucket.ls
30
31
  end
31
32
 
32
33
  it "#ls with arguments returns the file" do
33
34
  key = 'test/ls.txt'
34
- expect_any_instance_of(MockGCSBucket).to receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new)
35
+ expect_any_instance_of(MockGCSBucket).to(receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new))
35
36
 
36
37
  file = @bucket.ls(key)
37
- expect(file.class).to eq(Google::Cloud::Storage::File)
38
+ expect(file.class).to(eq(Google::Cloud::Storage::File))
38
39
  end
39
40
 
40
41
  it "#write writes a file into the bucket" do
41
42
  local_path = "#{directory}/products/key.txt"
42
43
  key = 'test/key.txt'
43
- expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
44
+ expect_any_instance_of(MockGCSBucket).to(receive(:create_file).with(
44
45
  local_path,
45
46
  "s#{@cloud.url}/#{key}",
46
47
  {}
47
- )
48
+ ))
48
49
 
49
50
  @bucket.write(key, local_path)
50
51
  end
@@ -53,13 +54,13 @@ describe AssetCloud::GCSBucket do
53
54
  local_path = "#{directory}/products/key.txt"
54
55
  key = 'test/key.txt'
55
56
  metadata = {
56
- "X-Robots-Tag" => "none"
57
+ "X-Robots-Tag" => "none",
57
58
  }
58
- expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
59
+ expect_any_instance_of(MockGCSBucket).to(receive(:create_file).with(
59
60
  local_path,
60
61
  "s#{@cloud.url}/#{key}",
61
62
  metadata: metadata
62
- )
63
+ ))
63
64
 
64
65
  @bucket.write(key, local_path, metadata: metadata)
65
66
  end
@@ -68,11 +69,11 @@ describe AssetCloud::GCSBucket do
68
69
  local_path = "#{directory}/products/key.txt"
69
70
  key = 'test/key.txt'
70
71
  acl = 'public'
71
- expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
72
+ expect_any_instance_of(MockGCSBucket).to(receive(:create_file).with(
72
73
  local_path,
73
74
  "s#{@cloud.url}/#{key}",
74
75
  acl: acl
75
- )
76
+ ))
76
77
 
77
78
  @bucket.write(key, local_path, acl: acl)
78
79
  end
@@ -81,41 +82,41 @@ describe AssetCloud::GCSBucket do
81
82
  local_path = "#{directory}/products/key.txt"
82
83
  key = 'test/key.txt'
83
84
  content_disposition = 'attachment'
84
- expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
85
+ expect_any_instance_of(MockGCSBucket).to(receive(:create_file).with(
85
86
  local_path,
86
87
  "s#{@cloud.url}/#{key}",
87
88
  content_disposition: content_disposition
88
- )
89
+ ))
89
90
 
90
91
  @bucket.write(key, local_path, content_disposition: content_disposition)
91
92
  end
92
93
 
93
94
  it "#delete removes the file from the bucket" do
94
95
  key = 'test/key.txt'
95
- expect_any_instance_of(MockGCSBucket).to receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new)
96
- expect_any_instance_of(Google::Cloud::Storage::File).to receive(:delete).with(no_args)
96
+ expect_any_instance_of(MockGCSBucket).to(receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new))
97
+ expect_any_instance_of(Google::Cloud::Storage::File).to(receive(:delete).with(no_args))
97
98
 
98
99
  expect do
99
100
  @bucket.delete(key)
100
- end.not_to raise_error
101
+ end.not_to(raise_error)
101
102
  end
102
103
 
103
104
  it "#read returns the data of the file" do
104
105
  value = 'hello world'
105
106
  key = 'tmp/new_file.txt'
106
- expect_any_instance_of(MockGCSBucket).to receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new)
107
- expect_any_instance_of(Google::Cloud::Storage::File).to receive(:download).and_return(StringIO.new(value))
107
+ expect_any_instance_of(MockGCSBucket).to(receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new))
108
+ expect_any_instance_of(Google::Cloud::Storage::File).to(receive(:download).and_return(StringIO.new(value)))
108
109
 
109
110
  data = @bucket.read(key)
110
- data.should == value
111
+ expect(data).to(eq(value))
111
112
  end
112
113
 
113
114
  it "#read raises AssetCloud::AssetNotFoundError if the file is not found" do
114
115
  key = 'tmp/not_found.txt'
115
- expect_any_instance_of(MockGCSBucket).to receive(:file).with("s#{@cloud.url}/#{key}").and_return(nil)
116
+ expect_any_instance_of(MockGCSBucket).to(receive(:file).with("s#{@cloud.url}/#{key}").and_return(nil))
116
117
  expect do
117
118
  @bucket.read(key)
118
- end.to raise_error(AssetCloud::AssetNotFoundError)
119
+ end.to(raise_error(AssetCloud::AssetNotFoundError))
119
120
  end
120
121
 
121
122
  it "#stat returns information on the asset" do
@@ -124,14 +125,14 @@ describe AssetCloud::GCSBucket do
124
125
  expected_time = Time.now
125
126
  expected_size = 1
126
127
 
127
- expect_any_instance_of(MockGCSBucket).to receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new)
128
- expect_any_instance_of(Google::Cloud::Storage::File).to receive(:size).and_return(expected_size)
129
- expect_any_instance_of(Google::Cloud::Storage::File).to receive(:created_at).and_return(expected_time)
130
- expect_any_instance_of(Google::Cloud::Storage::File).to receive(:updated_at).and_return(expected_time)
128
+ expect_any_instance_of(MockGCSBucket).to(receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new))
129
+ expect_any_instance_of(Google::Cloud::Storage::File).to(receive(:size).and_return(expected_size))
130
+ expect_any_instance_of(Google::Cloud::Storage::File).to(receive(:created_at).and_return(expected_time))
131
+ expect_any_instance_of(Google::Cloud::Storage::File).to(receive(:updated_at).and_return(expected_time))
131
132
 
132
133
  stats = @bucket.stat(key)
133
- expect(stats.size).to eq(expected_size)
134
- expect(stats.created_at).to eq(expected_time)
135
- expect(stats.updated_at).to eq(expected_time)
134
+ expect(stats.size).to(eq(expected_size))
135
+ expect(stats.created_at).to(eq(expected_time))
136
+ expect(stats.updated_at).to(eq(expected_time))
136
137
  end
137
138
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  class MemoryCloud < AssetCloud::Base
@@ -8,41 +9,39 @@ describe AssetCloud::MemoryBucket do
8
9
  directory = File.dirname(__FILE__) + '/files'
9
10
 
10
11
  before do
11
- @fs = MemoryCloud.new(directory , 'http://assets/files' )
12
+ @fs = MemoryCloud.new(directory, 'http://assets/files')
12
13
  end
13
14
 
14
15
  describe 'modifying items in subfolder' do
15
-
16
16
  it "should return nil when file does not exist" do
17
- @fs['memory/essay.txt'].exist?.should == false
17
+ expect(@fs['memory/essay.txt'].exist?).to(eq(false))
18
18
  end
19
19
 
20
20
  it "should return set content when asked for the same file" do
21
21
  @fs['memory/essay.txt'] = 'text'
22
- @fs['memory/essay.txt'].value.should == 'text'
22
+ expect(@fs['memory/essay.txt'].value).to(eq('text'))
23
23
  end
24
-
25
24
  end
26
25
 
27
26
  describe "#versioned?" do
28
27
  it "should return false" do
29
- @fs.buckets[:memory].versioned?.should == false
28
+ expect(@fs.buckets[:memory].versioned?).to(eq(false))
30
29
  end
31
30
  end
32
31
 
33
32
  describe '#ls' do
34
33
  before do
35
34
  %w{a b}.each do |letter|
36
- 2.times {|number| @fs.write("memory/#{letter}#{number}",'.')}
35
+ 2.times { |number| @fs.write("memory/#{letter}#{number}", '.') }
37
36
  end
38
37
  end
39
38
 
40
39
  it "should return a list of assets which start with the given prefix" do
41
- @fs.buckets[:memory].ls('memory/a').size.should == 2
40
+ expect(@fs.buckets[:memory].ls('memory/a').size).to(eq(2))
42
41
  end
43
42
 
44
43
  it "should return a list of all assets when a prefix is not given" do
45
- @fs.buckets[:memory].ls.size.should == 4
44
+ expect(@fs.buckets[:memory].ls.size).to(eq(4))
46
45
  end
47
46
  end
48
47
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ostruct'
2
3
 
3
4
  class MockS3Interface
@@ -7,7 +8,7 @@ class MockS3Interface
7
8
 
8
9
  attr_reader :bucket_storage
9
10
 
10
- def initialize(aws_access_key_id = nil, aws_secret_access_key = nil, params = {})
11
+ def initialize(_aws_access_key_id = nil, _aws_secret_access_key = nil, _params = {})
11
12
  @buckets = {}
12
13
  end
13
14
 
@@ -32,7 +33,7 @@ class MockS3Interface
32
33
 
33
34
  {
34
35
  content_length: options.body.size,
35
- last_modified: Time.parse("Mon Aug 27 17:37:51 UTC 2007")
36
+ last_modified: Time.parse("Mon Aug 27 17:37:51 UTC 2007"),
36
37
  }
37
38
  end
38
39
 
@@ -60,7 +61,7 @@ class MockS3Interface
60
61
  if options[:acl] && !VALID_ACLS.include?(options[:acl])
61
62
  raise "Invalid ACL `#{options[:acl].inspect}`, must be one of: #{VALID_ACLS.inspect}"
62
63
  end
63
-
64
+
64
65
  options[:body] = options[:body].force_encoding(Encoding::BINARY)
65
66
 
66
67
  key = options.delete(:key)
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  class RemoteS3Cloud < AssetCloud::Base
4
5
  attr_accessor :s3_connection
5
6
  bucket :tmp, AssetCloud::S3Bucket
6
7
 
7
- def s3_bucket(key)
8
+ def s3_bucket(_key)
8
9
  s3_connection.bucket(ENV['S3_BUCKET_NAME'])
9
10
  end
10
11
  end
@@ -21,14 +22,14 @@ describe 'Remote test for AssetCloud::S3Bucket', if: ENV['AWS_ACCESS_KEY_ID'] &&
21
22
  ),
22
23
  }
23
24
 
24
- @cloud = RemoteS3Cloud.new(directory , 'testing/assets/files' )
25
+ @cloud = RemoteS3Cloud.new(directory, 'testing/assets/files')
25
26
  @cloud.s3_connection = Aws::S3::Resource.new
26
27
  @bucket = @cloud.buckets[:tmp]
27
28
  end
28
29
 
29
30
  after(:all) do
30
31
  listing = @bucket.ls('tmp')
31
- listing.each { |object| object.delete }
32
+ listing.each(&:delete)
32
33
  end
33
34
 
34
35
  it "#ls should return assets with proper keys" do
@@ -37,8 +38,8 @@ describe 'Remote test for AssetCloud::S3Bucket', if: ENV['AWS_ACCESS_KEY_ID'] &&
37
38
 
38
39
  ls = @bucket.ls('tmp')
39
40
 
40
- expect(ls).to all(be_an(AssetCloud::Asset))
41
- expect(ls.map(&:key) - ['tmp/test1.txt', 'tmp/test2.txt']).to be_empty
41
+ expect(ls).to(all(be_an(AssetCloud::Asset)))
42
+ expect(ls.map(&:key) - ['tmp/test1.txt', 'tmp/test2.txt']).to(be_empty)
42
43
  end
43
44
 
44
45
  it "#ls returns all assets" do
@@ -47,8 +48,8 @@ describe 'Remote test for AssetCloud::S3Bucket', if: ENV['AWS_ACCESS_KEY_ID'] &&
47
48
 
48
49
  ls = @bucket.ls
49
50
 
50
- expect(ls).to all(be_an(AssetCloud::Asset))
51
- expect(ls.map(&:key) - ['tmp/test1.txt', 'tmp/test2.txt']).to be_empty
51
+ expect(ls).to(all(be_an(AssetCloud::Asset)))
52
+ expect(ls.map(&:key) - ['tmp/test1.txt', 'tmp/test2.txt']).to(be_empty)
52
53
  end
53
54
 
54
55
  it "#delete should ignore errors when deleting" do
@@ -58,7 +59,7 @@ describe 'Remote test for AssetCloud::S3Bucket', if: ENV['AWS_ACCESS_KEY_ID'] &&
58
59
  it "#delete should always return true" do
59
60
  @cloud['tmp/test1.txt'] = 'test1'
60
61
 
61
- @bucket.delete('tmp/test1.txt').should == true
62
+ expect(@bucket.delete('tmp/test1.txt')).to(eq(true))
62
63
  end
63
64
 
64
65
  it "#stat should get metadata from S3" do
@@ -66,14 +67,14 @@ describe 'Remote test for AssetCloud::S3Bucket', if: ENV['AWS_ACCESS_KEY_ID'] &&
66
67
  value = 'hello world'
67
68
  @cloud.build('tmp/new_file.test', value).store
68
69
  metadata = @bucket.stat('tmp/new_file.test')
69
- metadata.size.should == value.size
70
- metadata.updated_at.should >= start_time
70
+ expect(metadata.size).to(eq(value.size))
71
+ expect(metadata.updated_at).to(be >= start_time)
71
72
  end
72
73
 
73
74
  it "#stat a missing asset" do
74
75
  metadata = @bucket.stat('i_do_not_exist_and_never_will.test')
75
- expect(metadata).to be_an(AssetCloud::Metadata)
76
- expect(metadata.exist).to be false
76
+ expect(metadata).to(be_an(AssetCloud::Metadata))
77
+ expect(metadata.exist).to(be(false))
77
78
  end
78
79
 
79
80
  it "#read " do
@@ -81,19 +82,19 @@ describe 'Remote test for AssetCloud::S3Bucket', if: ENV['AWS_ACCESS_KEY_ID'] &&
81
82
  key = 'tmp/new_file.txt'
82
83
  @bucket.write(key, value)
83
84
  data = @bucket.read(key)
84
- data.should == value
85
+ expect(data).to(eq(value))
85
86
  end
86
87
 
87
88
  it "#read a missing asset" do
88
- expect { @bucket.read("i_do_not_exist_and_never_will.test") }.to raise_error(AssetCloud::AssetNotFoundError)
89
+ expect { @bucket.read("i_do_not_exist_and_never_will.test") }.to(raise_error(AssetCloud::AssetNotFoundError))
89
90
  end
90
91
 
91
92
  it "#reads first bytes when passed options" do
92
93
  value = 'hello world'
93
94
  key = 'tmp/new_file.txt'
94
- options = {range: 0...5}
95
+ options = { range: 0...5 }
95
96
  @bucket.write(key, value)
96
97
  data = @bucket.read(key, options)
97
- data.should == 'hello'
98
+ expect(data).to(eq('hello'))
98
99
  end
99
100
  end