middleman-s3_sync 3.3.7 → 3.3.8

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: d14f4fb3014e030baf26085c24f89a852c15f264
4
- data.tar.gz: b8c70ecb06640c69606de373237584b51951d9dd
3
+ metadata.gz: 7d6f64bd4cc8bd531a509a39d8016cf6547cb688
4
+ data.tar.gz: b39d69cf55120f47993514293c8a8d003a9e2530
5
5
  SHA512:
6
- metadata.gz: c203dd97741209ceedf3de39354f2bcb8c1d4e00b65bc09f4db4aba26479a027a4e67e0e8c69ea4b08523011ea3ba4ee8319c59a77362bea836b81682004b2c4
7
- data.tar.gz: 984fba641f37c53cf8c5da14e0b5a1fa2e0044cdb7fb5da997b010772bb58fc3f3a2061ef76afee11597d7d2117a7884593af271acd399907863dd7e36447398
6
+ metadata.gz: febf95daf6aae730a306717f84b39da170ee0a3156ed4c756a93877df21fc864e71c1222b1e6ddfaca55688a2d847d1f5673812b744e14692a3be0e78135e481
7
+ data.tar.gz: 8285acbdcf71288e8cdd3f6996f9fb552e80303f132b21af752644ffc52f32febf3de8928c31f29ece87168d6b2cf6c6f359af198978a6bc07d8ab36870dc8ae
@@ -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 = "3.3.7"
3
+ VERSION = "3.3.8"
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: 3.3.7
4
+ version: 3.3.8
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