font_assets 0.1.10 → 0.1.11

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.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### master
2
2
 
3
+ ### 0.1.11 / 2014-02-25
4
+
5
+ Bug Fixes
6
+
7
+ * Handle cases when PATH_INFO is nil or blank. Thanks [arunthampi](https://github.com/arunthampi)!
8
+
3
9
  ### 0.1.10 / 2013-07-07
4
10
 
5
11
  Fixing Regression
@@ -58,7 +58,11 @@ module FontAssets
58
58
  end
59
59
 
60
60
  def extension(path)
61
- "." + path.split("?").first.split(".").last
61
+ if path.nil? || path.length == 0
62
+ nil
63
+ else
64
+ "." + path.split("?").first.split(".").last
65
+ end
62
66
  end
63
67
 
64
68
  def font_asset?(path)
@@ -1,3 +1,3 @@
1
1
  module FontAssets
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
@@ -104,6 +104,36 @@ describe FontAssets::Middleware do
104
104
  its(['Content-Type']) { should == 'text/plain' }
105
105
  end
106
106
  end
107
+
108
+ context 'when PATH_INFO is nil' do
109
+ let(:app) { load_app }
110
+ let(:response) { request app, '/', 'PATH_INFO' => nil }
111
+
112
+ context 'the response headers' do
113
+ subject { response[1] }
114
+
115
+ its(["Access-Control-Allow-Headers"]) { should be_nil }
116
+ its(["Access-Control-Max-Age"]) { should be_nil }
117
+ its(['Access-Control-Allow-Methods']) { should be_nil }
118
+ its(['Access-Control-Allow-Origin']) { should be_nil }
119
+ its(['Content-Type']) { should == 'text/plain' }
120
+ end
121
+ end
122
+
123
+ context 'when PATH_INFO is empty string' do
124
+ let(:app) { load_app }
125
+ let(:response) { request app, '/', 'PATH_INFO' => ''}
126
+
127
+ context 'the response headers' do
128
+ subject { response[1] }
129
+
130
+ its(["Access-Control-Allow-Headers"]) { should be_nil }
131
+ its(["Access-Control-Max-Age"]) { should be_nil }
132
+ its(['Access-Control-Allow-Methods']) { should be_nil }
133
+ its(['Access-Control-Allow-Origin']) { should be_nil }
134
+ its(['Content-Type']) { should == 'text/plain' }
135
+ end
136
+ end
107
137
  end
108
138
 
109
139
  context 'for OPTIONS requests' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: font_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-04 00:00:00.000000000 Z
12
+ date: 2014-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack