asset_cloud 2.5.0 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  class SpecialAsset < AssetCloud::Asset
@@ -8,7 +9,7 @@ end
8
9
 
9
10
  class BasicCloud < AssetCloud::Base
10
11
  bucket :special, AssetCloud::MemoryBucket, asset_class: SpecialAsset
11
- bucket :conditional, AssetCloud::MemoryBucket, asset_class: Proc.new {|key|
12
+ bucket :conditional, AssetCloud::MemoryBucket, asset_class: proc { |key|
12
13
  LiquidAsset if key.ends_with?('.liquid')
13
14
  }
14
15
  end
@@ -17,71 +18,69 @@ describe BasicCloud do
17
18
  directory = File.dirname(__FILE__) + '/files'
18
19
 
19
20
  before do
20
- @fs = BasicCloud.new(directory , 'http://assets/files' )
21
+ @fs = BasicCloud.new(directory, 'http://assets/files')
21
22
  end
22
23
 
23
24
  it "should raise invalid bucket if none is given" do
24
- @fs['image.jpg'].exist?.should == false
25
+ expect(@fs['image.jpg'].exist?).to(eq(false))
25
26
  end
26
27
 
27
-
28
28
  it "should be backed by a file system bucket" do
29
- @fs['products/key.txt'].exist?.should == true
29
+ expect(@fs['products/key.txt'].exist?).to(eq(true))
30
30
  end
31
31
 
32
32
  it "should raise when listing non existing buckets" do
33
- @fs.ls('products').should == [AssetCloud::Asset.new(@fs, 'products/key.txt')]
33
+ expect(@fs.ls('products')).to(eq([AssetCloud::Asset.new(@fs, 'products/key.txt')]))
34
34
  end
35
35
 
36
-
37
36
  it "should allow you to create new assets" do
38
37
  obj = @fs.build('new_file.test')
39
- obj.should be_an_instance_of(AssetCloud::Asset)
40
- obj.cloud.should be_an_instance_of(BasicCloud)
38
+ expect(obj).to(be_an_instance_of(AssetCloud::Asset))
39
+ expect(obj.cloud).to(be_an_instance_of(BasicCloud))
41
40
  end
42
41
 
43
42
  it "should raise error when using with minus relative or absolute paths" do
44
- lambda { @fs['../test'] }.should raise_error(AssetCloud::IllegalPath)
45
- lambda { @fs['/test'] }.should raise_error(AssetCloud::IllegalPath)
46
- lambda { @fs['.../test'] }.should raise_error(AssetCloud::IllegalPath)
47
- lambda { @fs['./test'] }.should raise_error(AssetCloud::IllegalPath)
43
+ expect { @fs['../test'] }.to(raise_error(AssetCloud::IllegalPath))
44
+ expect { @fs['/test'] }.to(raise_error(AssetCloud::IllegalPath))
45
+ expect { @fs['.../test'] }.to(raise_error(AssetCloud::IllegalPath))
46
+ expect { @fs['./test'] }.to(raise_error(AssetCloud::IllegalPath))
48
47
  end
49
48
 
50
49
  it "should raise error when filename has trailing period" do
51
- lambda { @fs['test.'] }.should raise_error(AssetCloud::IllegalPath)
52
- lambda { @fs['/test/testfile.'] }.should raise_error(AssetCloud::IllegalPath)
53
- lambda { @fs['test/directory/.'] }.should raise_error(AssetCloud::IllegalPath)
54
- lambda { @fs['/test/testfile .'] }.should raise_error(AssetCloud::IllegalPath)
55
- lambda { @fs['test/directory /.'] }.should raise_error(AssetCloud::IllegalPath)
50
+ expect { @fs['test.'] }.to(raise_error(AssetCloud::IllegalPath))
51
+ expect { @fs['/test/testfile.'] }.to(raise_error(AssetCloud::IllegalPath))
52
+ expect { @fs['test/directory/.'] }.to(raise_error(AssetCloud::IllegalPath))
53
+ expect { @fs['/test/testfile .'] }.to(raise_error(AssetCloud::IllegalPath))
54
+ expect { @fs['test/directory /.'] }.to(raise_error(AssetCloud::IllegalPath))
56
55
  end
57
56
 
58
57
  it "should raise error when filename ends with space" do
59
- lambda { @fs['test '] }.should raise_error(AssetCloud::IllegalPath)
60
- lambda { @fs['/test/testfile '] }.should raise_error(AssetCloud::IllegalPath)
61
- lambda { @fs['test/directory/ '] }.should raise_error(AssetCloud::IllegalPath)
62
- lambda { @fs['test. '] }.should raise_error(AssetCloud::IllegalPath)
63
- lambda { @fs['/test/testfile. '] }.should raise_error(AssetCloud::IllegalPath)
64
- lambda { @fs['test/directory/. '] }.should raise_error(AssetCloud::IllegalPath)
58
+ expect { @fs['test '] }.to(raise_error(AssetCloud::IllegalPath))
59
+ expect { @fs['/test/testfile '] }.to(raise_error(AssetCloud::IllegalPath))
60
+ expect { @fs['test/directory/ '] }.to(raise_error(AssetCloud::IllegalPath))
61
+ expect { @fs['test. '] }.to(raise_error(AssetCloud::IllegalPath))
62
+ expect { @fs['/test/testfile. '] }.to(raise_error(AssetCloud::IllegalPath))
63
+ expect { @fs['test/directory/. '] }.to(raise_error(AssetCloud::IllegalPath))
65
64
  end
66
65
 
67
66
  it "should raise error when filename ends with slash" do
68
- lambda { @fs['test/'] }.should raise_error(AssetCloud::IllegalPath)
69
- lambda { @fs['test/directory/'] }.should raise_error(AssetCloud::IllegalPath)
70
- lambda { @fs['test /'] }.should raise_error(AssetCloud::IllegalPath)
71
- lambda { @fs['/test/testfile /'] }.should raise_error(AssetCloud::IllegalPath)
72
- lambda { @fs['test/directory//'] }.should raise_error(AssetCloud::IllegalPath)
67
+ expect { @fs['test/'] }.to(raise_error(AssetCloud::IllegalPath))
68
+ expect { @fs['test/directory/'] }.to(raise_error(AssetCloud::IllegalPath))
69
+ expect { @fs['test /'] }.to(raise_error(AssetCloud::IllegalPath))
70
+ expect { @fs['/test/testfile /'] }.to(raise_error(AssetCloud::IllegalPath))
71
+ expect { @fs['test/directory//'] }.to(raise_error(AssetCloud::IllegalPath))
73
72
  end
74
73
 
75
74
  it "should raise error when using with minus relative even after another directory" do
76
- lambda { @fs['test/../test'] }.should raise_error(AssetCloud::IllegalPath)
77
- lambda { @fs['test/../../test'] }.should raise_error(AssetCloud::IllegalPath)
78
- lambda { @fs['test/../../../test']}.should raise_error(AssetCloud::IllegalPath)
75
+ expect { @fs['test/../test'] }.to(raise_error(AssetCloud::IllegalPath))
76
+ expect { @fs['test/../../test'] }.to(raise_error(AssetCloud::IllegalPath))
77
+ expect { @fs['test/../../../test'] }.to(raise_error(AssetCloud::IllegalPath))
79
78
  end
80
79
 
81
80
  it "should raise an error when using names with combinations of '.' and ' '" do
82
- lambda { @fs['test. . . .. ... .. . '] }.should raise_error(AssetCloud::IllegalPath)
83
- lambda { @fs['test. .'] }.should raise_error(AssetCloud::IllegalPath)
84
- lambda { @fs['test. .test2'] }.should raise_error(AssetCloud::IllegalPath)
81
+ expect { @fs['test. . . .. ... .. . '] }.to(raise_error(AssetCloud::IllegalPath))
82
+ expect { @fs['test. .'] }.to(raise_error(AssetCloud::IllegalPath))
83
+ expect { @fs['test. .test2'] }.to(raise_error(AssetCloud::IllegalPath))
85
84
  end
86
85
 
87
86
  it "should allow filenames with repeating dots" do
@@ -125,41 +124,41 @@ describe BasicCloud do
125
124
  end
126
125
 
127
126
  it "should compute complete urls to assets" do
128
- @fs.url_for('products/key with spaces.txt').should == 'http://assets/files/products/key%20with%20spaces.txt'
127
+ expect(@fs.url_for('products/[key] with spaces.txt?foo=1&bar=2')).to(eq('http://assets/files/products/[key]%20with%20spaces.txt?foo=1&bar=2'))
129
128
  end
130
129
 
131
130
  describe "#find" do
132
131
  it "should return the appropriate asset when one exists" do
133
132
  asset = @fs.find('products/key.txt')
134
- asset.key.should == 'products/key.txt'
135
- asset.value.should == 'value'
133
+ expect(asset.key).to(eq('products/key.txt'))
134
+ expect(asset.value).to(eq('value'))
136
135
  end
137
136
  it "should raise AssetNotFoundError when the asset doesn't exist" do
138
- lambda { @fs.find('products/not-there.txt') }.should raise_error(AssetCloud::AssetNotFoundError)
137
+ expect { @fs.find('products/not-there.txt') }.to(raise_error(AssetCloud::AssetNotFoundError))
139
138
  end
140
139
  end
141
140
 
142
141
  describe "#[]" do
143
142
  it "should return the appropriate asset when one exists" do
144
143
  asset = @fs['products/key.txt']
145
- asset.key.should == 'products/key.txt'
146
- asset.value.should == 'value'
144
+ expect(asset.key).to(eq('products/key.txt'))
145
+ expect(asset.value).to(eq('value'))
147
146
  end
148
147
  it "should not raise any errors when the asset doesn't exist" do
149
- lambda { @fs['products/not-there.txt'] }.should_not raise_error
148
+ expect { @fs['products/not-there.txt'] }.not_to(raise_error)
150
149
  end
151
150
  end
152
151
 
153
152
  describe "#move" do
154
153
  it "should return move a resource" do
155
154
  asset = @fs['products/key.txt']
156
- asset.key.should == 'products/key.txt'
157
- asset.value.should == 'value'
155
+ expect(asset.key).to(eq('products/key.txt'))
156
+ expect(asset.value).to(eq('value'))
158
157
  @fs.move('products/key.txt', 'products/key2.txt')
159
158
  new_asset = @fs['products/key2.txt']
160
- new_asset.key.should == 'products/key2.txt'
161
- new_asset.value.should == 'value'
162
- expect {@fs['products/key.txt'].value }.to raise_error(AssetCloud::AssetNotFoundError)
159
+ expect(new_asset.key).to(eq('products/key2.txt'))
160
+ expect(new_asset.value).to(eq('value'))
161
+ expect { @fs['products/key.txt'].value }.to(raise_error(AssetCloud::AssetNotFoundError))
163
162
  @fs.move('products/key2.txt', 'products/key.txt')
164
163
  end
165
164
  end
@@ -167,46 +166,45 @@ describe BasicCloud do
167
166
  describe "#[]=" do
168
167
  it "should write through the Asset object (and thus run any callbacks on the asset)" do
169
168
  special_asset = double(:special_asset)
170
- special_asset.should_receive(:value=).with('fancy fancy!')
171
- special_asset.should_receive(:store)
172
- SpecialAsset.should_receive(:at).and_return(special_asset)
169
+ expect(special_asset).to(receive(:value=).with('fancy fancy!'))
170
+ expect(special_asset).to(receive(:store))
171
+ expect(SpecialAsset).to(receive(:at).and_return(special_asset))
173
172
  @fs['special/fancy.txt'] = 'fancy fancy!'
174
173
  end
175
174
  end
176
175
 
177
176
  describe "#bucket" do
178
177
  it "should allow specifying a class to use for assets in this bucket" do
179
- @fs['assets/rails_logo.gif'].should be_instance_of(AssetCloud::Asset)
180
- @fs['special/fancy.txt'].should be_instance_of(SpecialAsset)
178
+ expect(@fs['assets/rails_logo.gif']).to(be_instance_of(AssetCloud::Asset))
179
+ expect(@fs['special/fancy.txt']).to(be_instance_of(SpecialAsset))
181
180
 
182
- @fs.build('assets/foo').should be_instance_of(AssetCloud::Asset)
183
- @fs.build('special/foo').should be_instance_of(SpecialAsset)
181
+ expect(@fs.build('assets/foo')).to(be_instance_of(AssetCloud::Asset))
182
+ expect(@fs.build('special/foo')).to(be_instance_of(SpecialAsset))
184
183
  end
185
184
 
186
185
  it "should allow specifying a proc that determines the class to use, using the default bucket when returning nil" do
187
- @fs.build('conditional/default.js').should be_instance_of(AssetCloud::Asset)
188
- @fs.build('conditional/better.liquid').should be_instance_of(LiquidAsset)
186
+ expect(@fs.build('conditional/default.js')).to(be_instance_of(AssetCloud::Asset))
187
+ expect(@fs.build('conditional/better.liquid')).to(be_instance_of(LiquidAsset))
189
188
  end
190
189
 
191
190
  it "should raise " do
192
- expect { BasicCloud.bucket(AssetCloud::MemoryBucket, asset_class: Proc.new {}) }.to(raise_error(ArgumentError))
191
+ expect { BasicCloud.bucket(AssetCloud::MemoryBucket, asset_class: proc {}) }.to(raise_error(ArgumentError))
193
192
  end
194
193
  end
195
194
 
196
195
  describe "MATCH_BUCKET" do
197
196
  it "should match following stuff " do
198
-
199
197
  'products/key.txt' =~ AssetCloud::Base::MATCH_BUCKET
200
- $1.should == 'products'
198
+ expect(Regexp.last_match(1)).to(eq('products'))
201
199
 
202
200
  'products/subpath/key.txt' =~ AssetCloud::Base::MATCH_BUCKET
203
- $1.should == 'products'
201
+ expect(Regexp.last_match(1)).to(eq('products'))
204
202
 
205
203
  'key.txt' =~ AssetCloud::Base::MATCH_BUCKET
206
- $1.should == nil
204
+ expect(Regexp.last_match(1)).to(eq(nil))
207
205
 
208
206
  'products' =~ AssetCloud::Base::MATCH_BUCKET
209
- $1.should == 'products'
207
+ expect(Regexp.last_match(1)).to(eq('products'))
210
208
  end
211
209
  end
212
210
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  class BlackholeCloud < AssetCloud::Base
@@ -8,7 +9,7 @@ describe BlackholeCloud do
8
9
  directory = File.dirname(__FILE__) + '/files'
9
10
 
10
11
  before do
11
- @fs = BlackholeCloud.new(directory , 'http://assets/files' )
12
+ @fs = BlackholeCloud.new(directory, 'http://assets/files')
12
13
  end
13
14
 
14
15
  it "should allow access to files using the [] operator" do
@@ -16,12 +17,12 @@ describe BlackholeCloud do
16
17
  end
17
18
 
18
19
  it "should return nil for non existent files" do
19
- @fs['tmp/image.jpg'].exist?.should == false
20
+ expect(@fs['tmp/image.jpg'].exist?).to(eq(false))
20
21
  end
21
22
 
22
23
  it "should still return nil, even if you wrote something there" do
23
24
  @fs['tmp/image.jpg'] = 'test'
24
- @fs['tmp/image.jpg'].exist?.should == false
25
+ expect(@fs['tmp/image.jpg'].exist?).to(eq(false))
25
26
  end
26
27
 
27
28
  describe "when using a sub path" do
@@ -30,12 +31,12 @@ describe BlackholeCloud do
30
31
  end
31
32
 
32
33
  it "should return nil for non existent files" do
33
- @fs['tmp/image.jpg'].exist?.should == false
34
+ expect(@fs['tmp/image.jpg'].exist?).to(eq(false))
34
35
  end
35
36
 
36
37
  it "should still return nil, even if you wrote something there" do
37
38
  @fs['tmp/image.jpg'] = 'test'
38
- @fs['tmp/image.jpg'].exist?.should == false
39
+ expect(@fs['tmp/image.jpg'].exist?).to(eq(false))
39
40
  end
40
41
  end
41
42
  end
@@ -1,58 +1,59 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  class ChainedCloud < AssetCloud::Base
4
- bucket :stuff, AssetCloud::BucketChain.chain( AssetCloud::MemoryBucket,
5
+ bucket :stuff, AssetCloud::BucketChain.chain(AssetCloud::MemoryBucket,
5
6
  AssetCloud::MemoryBucket,
6
- AssetCloud::FileSystemBucket )
7
+ AssetCloud::FileSystemBucket)
7
8
 
8
- bucket :versioned_stuff, AssetCloud::BucketChain.chain( AssetCloud::FileSystemBucket,
9
+ bucket :versioned_stuff, AssetCloud::BucketChain.chain(AssetCloud::FileSystemBucket,
9
10
  AssetCloud::VersionedMemoryBucket,
10
- AssetCloud::MemoryBucket )
11
+ AssetCloud::MemoryBucket)
11
12
  end
12
13
 
13
14
  describe AssetCloud::BucketChain do
14
15
  directory = File.dirname(__FILE__) + '/files'
15
16
 
16
17
  before(:each) do
17
- @cloud = ChainedCloud.new(directory , 'http://assets/files' )
18
+ @cloud = ChainedCloud.new(directory, 'http://assets/files')
18
19
  @bucket_chain = @cloud.buckets[:stuff]
19
20
  @chained_buckets = @bucket_chain.chained_buckets
20
- @chained_buckets.each {|b| b.ls('stuff').each {|asset| asset.delete}}
21
+ @chained_buckets.each { |b| b.ls('stuff').each(&:delete) }
21
22
 
22
23
  @versioned_stuff = @cloud.buckets[:versioned_stuff]
23
24
  end
24
25
 
25
26
  describe ".chain" do
26
27
  it 'should take multiple Bucket classes and return a new Bucket class' do
27
- @bucket_chain.should be_a_kind_of(AssetCloud::BucketChain)
28
+ expect(@bucket_chain).to(be_a_kind_of(AssetCloud::BucketChain))
28
29
  end
29
30
  end
30
31
 
31
32
  describe "#write" do
32
33
  it 'should write to each sub-bucket when everything is kosher and return the result of the first write' do
33
34
  @chained_buckets.each do |bucket|
34
- bucket.should_receive(:write).with('stuff/foo', 'successful creation').and_return('successful creation')
35
+ expect(bucket).to(receive(:write).with('stuff/foo', 'successful creation').and_return('successful creation'))
35
36
  end
36
37
 
37
- @bucket_chain.write('stuff/foo', 'successful creation').should == 'successful creation'
38
+ expect(@bucket_chain.write('stuff/foo', 'successful creation')).to(eq('successful creation'))
38
39
  end
39
40
  it 'should roll back creation-writes and re-raise an error when a bucket raises one' do
40
- @chained_buckets.last.should_receive(:write).with('stuff/foo', 'unsuccessful creation').and_raise('hell')
41
+ expect(@chained_buckets.last).to(receive(:write).with('stuff/foo', 'unsuccessful creation').and_raise('hell'))
41
42
  @chained_buckets[0..-2].each do |bucket|
42
- bucket.should_receive(:write).with('stuff/foo', 'unsuccessful creation').and_return(true)
43
- bucket.should_receive(:delete).with('stuff/foo').and_return(true)
43
+ expect(bucket).to(receive(:write).with('stuff/foo', 'unsuccessful creation').and_return(true))
44
+ expect(bucket).to(receive(:delete).with('stuff/foo').and_return(true))
44
45
  end
45
46
 
46
- lambda { @bucket_chain.write('stuff/foo', 'unsuccessful creation') }.should raise_error(RuntimeError)
47
+ expect { @bucket_chain.write('stuff/foo', 'unsuccessful creation') }.to(raise_error(RuntimeError))
47
48
  end
48
49
  it 'should roll back update-writes and re-raise an error when a bucket raises one' do
49
50
  @bucket_chain.write('stuff/foo', "original value")
50
51
 
51
- @chained_buckets.last.should_receive(:write).with('stuff/foo', 'new value').and_raise('hell')
52
+ expect(@chained_buckets.last).to(receive(:write).with('stuff/foo', 'new value').and_raise('hell'))
52
53
 
53
- lambda { @bucket_chain.write('stuff/foo', 'new value') }.should raise_error(RuntimeError)
54
+ expect { @bucket_chain.write('stuff/foo', 'new value') }.to(raise_error(RuntimeError))
54
55
  @chained_buckets.each do |bucket|
55
- bucket.read('stuff/foo').should == 'original value'
56
+ expect(bucket.read('stuff/foo')).to(eq('original value'))
56
57
  end
57
58
  end
58
59
  end
@@ -62,7 +63,7 @@ describe AssetCloud::BucketChain do
62
63
  @bucket_chain.write('stuff/foo', "successful deletion comin' up")
63
64
 
64
65
  @chained_buckets.each do |bucket|
65
- bucket.should_receive(:delete).with('stuff/foo').and_return(true)
66
+ expect(bucket).to(receive(:delete).with('stuff/foo').and_return(true))
66
67
  end
67
68
 
68
69
  @bucket_chain.delete('stuff/foo')
@@ -70,47 +71,46 @@ describe AssetCloud::BucketChain do
70
71
  it 'should roll back deletions and re-raise an error when a bucket raises one' do
71
72
  @bucket_chain.write('stuff/foo', "this deletion will fail")
72
73
 
73
- @chained_buckets.last.should_receive(:delete).with('stuff/foo').and_raise('hell')
74
+ expect(@chained_buckets.last).to(receive(:delete).with('stuff/foo').and_raise('hell'))
74
75
  @chained_buckets[0..-2].each do |bucket|
75
- bucket.should_receive(:delete).with('stuff/foo').and_return(true)
76
- bucket.should_receive(:write).with('stuff/foo', 'this deletion will fail').and_return(true)
76
+ expect(bucket).to(receive(:delete).with('stuff/foo').and_return(true))
77
+ expect(bucket).to(receive(:write).with('stuff/foo', 'this deletion will fail').and_return(true))
77
78
  end
78
79
 
79
- lambda { @bucket_chain.delete('stuff/foo') }.should raise_error(RuntimeError)
80
+ expect { @bucket_chain.delete('stuff/foo') }.to(raise_error(RuntimeError))
80
81
  end
81
82
  end
82
83
 
83
84
  describe "#read" do
84
85
  it 'should read from only the first available sub-bucket' do
85
- @chained_buckets[0].should_receive(:read).with('stuff/foo').and_raise(NotImplementedError)
86
- @chained_buckets[0].should_receive(:ls).with(nil).and_raise(NoMethodError)
87
- @chained_buckets[0].should_receive(:stat).and_return(:metadata)
86
+ expect(@chained_buckets[0]).to(receive(:read).with('stuff/foo').and_raise(NotImplementedError))
87
+ expect(@chained_buckets[0]).to(receive(:ls).with(nil).and_raise(NoMethodError))
88
+ expect(@chained_buckets[0]).to(receive(:stat).and_return(:metadata))
88
89
 
89
- @chained_buckets[1].should_receive(:read).with('stuff/foo').and_return('bar')
90
- @chained_buckets[1].should_receive(:ls).with(nil).and_return(:some_assets)
91
- @chained_buckets[1].should_not_receive(:stat)
90
+ expect(@chained_buckets[1]).to(receive(:read).with('stuff/foo').and_return('bar'))
91
+ expect(@chained_buckets[1]).to(receive(:ls).with(nil).and_return(:some_assets))
92
+ expect(@chained_buckets[1]).not_to(receive(:stat))
92
93
 
93
94
  @chained_buckets[2..-1].each do |bucket|
94
- bucket.should_not_receive(:read)
95
- bucket.should_not_receive(:ls)
96
- bucket.should_not_receive(:stat)
95
+ expect(bucket).not_to(receive(:read))
96
+ expect(bucket).not_to(receive(:ls))
97
+ expect(bucket).not_to(receive(:stat))
97
98
  end
98
99
 
99
- @bucket_chain.read('stuff/foo').should == 'bar'
100
- @bucket_chain.ls.should == :some_assets
101
- @bucket_chain.stat.should == :metadata
100
+ expect(@bucket_chain.read('stuff/foo')).to(eq('bar'))
101
+ expect(@bucket_chain.ls).to(eq(:some_assets))
102
+ expect(@bucket_chain.stat).to(eq(:metadata))
102
103
  end
103
104
  end
104
105
 
105
-
106
106
  describe "#read_version" do
107
107
  it 'should read from only the first available sub-bucket' do
108
108
  buckets = @versioned_stuff.chained_buckets
109
109
 
110
- buckets[1].should_receive(:read_version).with('stuff/foo',3).and_return('bar')
111
- buckets.last.should_not_receive(:read_version)
110
+ expect(buckets[1]).to(receive(:read_version).with('stuff/foo', 3).and_return('bar'))
111
+ expect(buckets.last).not_to(receive(:read_version))
112
112
 
113
- @versioned_stuff.read_version('stuff/foo', 3).should == 'bar'
113
+ expect(@versioned_stuff.read_version('stuff/foo', 3)).to(eq('bar'))
114
114
  end
115
115
  end
116
116
 
@@ -118,10 +118,10 @@ describe AssetCloud::BucketChain do
118
118
  it 'should read from only the first available sub-bucket' do
119
119
  buckets = @versioned_stuff.chained_buckets
120
120
 
121
- buckets[1].should_receive(:versions).with('versioned_stuff/foo').and_return([1,2,3])
122
- buckets.last.should_not_receive(:versions)
121
+ expect(buckets[1]).to(receive(:versions).with('versioned_stuff/foo').and_return([1, 2, 3]))
122
+ expect(buckets.last).not_to(receive(:versions))
123
123
 
124
- @versioned_stuff.versions('versioned_stuff/foo').should == [1,2,3]
124
+ expect(@versioned_stuff.versions('versioned_stuff/foo')).to(eq([1, 2, 3]))
125
125
  end
126
126
  end
127
127
 
@@ -131,28 +131,28 @@ describe AssetCloud::BucketChain do
131
131
  @cloud['versioned_stuff/foo'] = content
132
132
  end
133
133
  asset = @cloud['versioned_stuff/foo']
134
- asset.value.should == 'three'
135
- asset.rollback(1).value.should == 'one'
136
- asset.versions.should == [1,2,3]
134
+ expect(asset.value).to(eq('three'))
135
+ expect(asset.rollback(1).value).to(eq('one'))
136
+ expect(asset.versions).to(eq([1, 2, 3]))
137
137
  asset.value = 'four'
138
138
  asset.store
139
- asset.versions.should == [1,2,3,4]
139
+ expect(asset.versions).to(eq([1, 2, 3, 4]))
140
140
  end
141
141
  end
142
142
 
143
143
  describe '#respond_to?' do
144
144
  it 'should return true if any chained buckets respond to the given method' do
145
- @bucket_chain.respond_to?(:foo).should == false
146
- @chained_buckets[1].should_receive(:respond_to?).with(:bar).and_return(true)
147
- @bucket_chain.respond_to?(:bar).should == true
145
+ expect(@bucket_chain.respond_to?(:foo)).to(eq(false))
146
+ expect(@chained_buckets[1]).to(receive(:respond_to?).with(:bar).and_return(true))
147
+ expect(@bucket_chain.respond_to?(:bar)).to(eq(true))
148
148
  end
149
149
  end
150
150
 
151
151
  describe '#method_missing' do
152
152
  it 'should try each bucket' do
153
- @chained_buckets[1].should_receive(:buzz).and_return(true)
154
- @chained_buckets[2].should_not_receive(:buzz)
155
- @bucket_chain.buzz.should == true
153
+ expect(@chained_buckets[1]).to(receive(:buzz).and_return(true))
154
+ expect(@chained_buckets[2]).not_to(receive(:buzz))
155
+ expect(@bucket_chain.buzz).to(eq(true))
156
156
  end
157
157
  end
158
158
  end