asset_cloud 2.2.9 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/asset_cloud.gemspec +1 -1
- data/lib/asset_cloud/asset.rb +7 -1
- data/spec/asset_spec.rb +38 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9915f9ae949c5a943ba524a2816df249c3e6ab3cc295786fc0cbbad6dd1690c4
|
4
|
+
data.tar.gz: e0b47f11c95a23903c702ed9f1c8b41fdb4115a459ae83937448902efb22ff56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd7caa8ab93936dfa3dc2a8823eaa3d8e6de5fc53a1c81928946595dbac5a67e67f2d925385494e30dcbfca18a16b3de805d2e6aab0ae32effa1b8abe063efdf
|
7
|
+
data.tar.gz: 59a74007e74f62b823d902414f6275ad26974f55fa0fb75f15a5bdef09ec104dee5ad2a673d5c8a6cb73fe94527ffce07783cd0ce3598721b66a0d8086672d9f
|
data/asset_cloud.gemspec
CHANGED
data/lib/asset_cloud/asset.rb
CHANGED
@@ -34,7 +34,13 @@ module AssetCloud
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def <=>(other)
|
37
|
-
|
37
|
+
return 1 unless other.is_a?(Asset)
|
38
|
+
compare_cloud = cloud.object_id <=> other.cloud.object_id
|
39
|
+
if compare_cloud == 0
|
40
|
+
key <=> other.key
|
41
|
+
else
|
42
|
+
compare_cloud
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
46
|
def new_asset?
|
data/spec/asset_spec.rb
CHANGED
@@ -173,5 +173,43 @@ describe "Asset" do
|
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
+
describe "comparable" do
|
177
|
+
before do
|
178
|
+
@key = "products/key.txt"
|
179
|
+
@asset = AssetCloud::Asset.new(@cloud, @key)
|
180
|
+
end
|
181
|
+
|
182
|
+
context "comparing to instance of Asset class" do
|
183
|
+
it "is equal if cloud and key of both assets are equal" do
|
184
|
+
other_asset = AssetCloud::Asset.new(@cloud, @key)
|
185
|
+
|
186
|
+
expect(@asset == other_asset).to eq(true)
|
187
|
+
end
|
188
|
+
|
189
|
+
it "is not equal if cloud of both assets are not equal" do
|
190
|
+
other_cloud = double('Cloud2', :asset_extension_classes_for_bucket => [], :object_id => 999)
|
191
|
+
other_asset = AssetCloud::Asset.new(other_cloud, @key)
|
192
|
+
|
193
|
+
expect(@asset == other_asset).to eq(false)
|
194
|
+
end
|
176
195
|
|
196
|
+
it "is not equal if key of both assets are not equal" do
|
197
|
+
other_key = "products/other_key.txt"
|
198
|
+
other_asset = AssetCloud::Asset.new(@cloud, other_key)
|
199
|
+
|
200
|
+
expect(@asset == other_asset).to eq(false)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
context "comparing to instance of non-Asset class" do
|
205
|
+
it "is not equal to a non-Asset object" do
|
206
|
+
AssetCloud::Asset.new(@cloud, "products/foo, bar.txt", "data")
|
207
|
+
|
208
|
+
expect(@asset == "some_string").to eq(false)
|
209
|
+
expect(@asset == :some_symbol).to eq(false)
|
210
|
+
expect(@asset == []).to eq(false)
|
211
|
+
expect(@asset == nil).to eq(false)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
177
215
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|