middleman-s3_sync 4.0.1.rc.3 → 4.0.1.rc.4

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
  SHA1:
3
- metadata.gz: bea5e269ad1b736d2a88b7d8b8702642a74085ff
4
- data.tar.gz: 27276f776111a9c38dfd8b8e6483c251267df0bc
3
+ metadata.gz: 3cc5e83da7bfd7639905564a61f26cc74916b1e8
4
+ data.tar.gz: c4f2d171cf39e6a5c6ea2776a8813b0dee89992d
5
5
  SHA512:
6
- metadata.gz: 186a272a11c2f2c2a199a1ef011010045acb73af9ff7d5169988f66697cde61a8df8c0e90deaf2778d5a9e43acf94bfa6d4bd0215272cdd11c50cfad4cbb1ed7
7
- data.tar.gz: bc83e3b244f390f7dc8ae86dd864c2155365a08b2ae180c8f1f789e5ec820fb32a5c0525ee426b4917d677323facd1ca9cd1331f45157773d0634daf7f625b86
6
+ metadata.gz: 8c140b7a8ac66998daa5ab29d263c8ac6c2669b359f305b6a6874afd766f855db5ffe67ba259f27a15cd3fcb95c7e7d2a4f9c7109a39080957de231f51be6bef
7
+ data.tar.gz: 7d6105e86327e6337e8ed340fa6122d5423fb309d5b6ed00b3f3ce2b6a3dd8d28a1db7c4da154d723275b6c73585cdb0ac2b25833402d7f37ff6efd2dc0a0f38
@@ -8,6 +8,7 @@ module Middleman
8
8
  end
9
9
 
10
10
  def caching_policy_for(content_type)
11
+ return default_caching_policy if content_type.nil? || content_type.empty?
11
12
  caching_policies.fetch(content_type.to_s.split(';').first.strip, caching_policies[:default])
12
13
  end
13
14
 
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module S3Sync
3
- VERSION = "4.0.1.rc.3"
3
+ VERSION = "4.0.1.rc.4"
4
4
  end
5
5
  end
@@ -96,3 +96,25 @@ describe "Storing and retrieving policies" do
96
96
  expect(policy.policies.max_age).to eq(300)
97
97
  end
98
98
  end
99
+
100
+ describe "Handling situations where the content type is nil" do
101
+ class CachingPolicy
102
+ include Middleman::S3Sync::CachingPolicy
103
+ end
104
+
105
+ let(:caching_policy) { CachingPolicy.new }
106
+
107
+ it "returns the default caching policy when the content type is nil" do
108
+ caching_policy.add_caching_policy(:default, max_age:(60 * 60 * 24 * 365))
109
+
110
+ expect(caching_policy.caching_policy_for(nil)).to_not be_nil
111
+ expect(caching_policy.caching_policy_for(nil).policies[:max_age]).to eq(60 * 60 * 24 * 365)
112
+ end
113
+
114
+ it "returns the default caching policy when the content type is blank" do
115
+ caching_policy.add_caching_policy(:default, max_age:(60 * 60 * 24 * 365))
116
+
117
+ expect(caching_policy.caching_policy_for("")).to_not be_nil
118
+ expect(caching_policy.caching_policy_for("").policies[:max_age]).to eq(60 * 60 * 24 * 365)
119
+ end
120
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-s3_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1.rc.3
4
+ version: 4.0.1.rc.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frederic Jean
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-04 00:00:00.000000000 Z
12
+ date: 2016-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core