asset_cloud 2.2.9 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e767cf7119375ff7308f312b510f99cd89705e1d44ae556e89853bc8f55f2dd
4
- data.tar.gz: 285705891684bc782af8326be994698a9282a4abf19d24df0759cc9a53461752
3
+ metadata.gz: 9915f9ae949c5a943ba524a2816df249c3e6ab3cc295786fc0cbbad6dd1690c4
4
+ data.tar.gz: e0b47f11c95a23903c702ed9f1c8b41fdb4115a459ae83937448902efb22ff56
5
5
  SHA512:
6
- metadata.gz: b10838d5eb09a7efcb7a09ecbdc0ac63e879b233e6208a28aefde0faa811f53464eafb944aaf46bc8f71de3115cdade371bcd8516ad09e18162b8bfe2e383eb7
7
- data.tar.gz: 738c8e086da574cfe5200b19da555a765cf482c8df341eb6168ee3864f08a42a211844f340177fda5aa34573473552d764063e7df6510a11ae0b2d66c8aa5cfe
6
+ metadata.gz: dd7caa8ab93936dfa3dc2a8823eaa3d8e6de5fc53a1c81928946595dbac5a67e67f2d925385494e30dcbfca18a16b3de805d2e6aab0ae32effa1b8abe063efdf
7
+ data.tar.gz: 59a74007e74f62b823d902414f6275ad26974f55fa0fb75f15a5bdef09ec104dee5ad2a673d5c8a6cb73fe94527ffce07783cd0ce3598721b66a0d8086672d9f
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{asset_cloud}
5
- s.version = "2.2.9"
5
+ s.version = "2.3.0"
6
6
 
7
7
  s.authors = %w(Shopify)
8
8
  s.summary = %q{An abstraction layer around arbitrary and diverse asset stores.}
@@ -34,7 +34,13 @@ module AssetCloud
34
34
  end
35
35
 
36
36
  def <=>(other)
37
- cloud.object_id <=> other.cloud.object_id && key <=> other.key
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?
@@ -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.2.9
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: 2019-11-15 00:00:00.000000000 Z
11
+ date: 2020-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport