zassets 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zassets/server.rb +10 -3
- data/lib/zassets/version.rb +1 -1
- data/spec/zassets/server_spec.rb +9 -2
- metadata +2 -2
data/lib/zassets/server.rb
CHANGED
@@ -39,11 +39,18 @@ module ZAssets
|
|
39
39
|
end
|
40
40
|
|
41
41
|
map '/' do
|
42
|
+
static_files = Rack::File.new config[:public_path]
|
43
|
+
|
42
44
|
if config[:public_file]
|
43
|
-
|
44
|
-
|
45
|
+
run Rack::Cascade.new([
|
46
|
+
static_files,
|
47
|
+
MemoryFile.new(File.new(File.join(
|
48
|
+
config[:public_path],
|
49
|
+
config[:public_file]
|
50
|
+
)))
|
51
|
+
])
|
45
52
|
else
|
46
|
-
run
|
53
|
+
run static_files
|
47
54
|
end
|
48
55
|
end
|
49
56
|
end
|
data/lib/zassets/version.rb
CHANGED
data/spec/zassets/server_spec.rb
CHANGED
@@ -56,14 +56,14 @@ module ZAssets
|
|
56
56
|
let(:response) { app.get path }
|
57
57
|
|
58
58
|
it 'logs queries' do
|
59
|
-
expect(
|
59
|
+
expect(response.errors).to match(/GET \/.+404.+/)
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'shows exceptions' do
|
63
63
|
allow_any_instance_of(SprocketsEnv).to receive(:call) { raise RuntimeError }
|
64
64
|
response = app.get(config[:base_url])
|
65
65
|
expect(response).to be_server_error
|
66
|
-
expect(response).to match /RuntimeError/
|
66
|
+
expect(response.body).to match /RuntimeError/
|
67
67
|
end
|
68
68
|
|
69
69
|
context 'assets mount point' do
|
@@ -101,6 +101,13 @@ module ZAssets
|
|
101
101
|
expect(response.body).to eq "hello HTML!\n"
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
it 'serves static file' do
|
106
|
+
within_fixture_path do
|
107
|
+
response = app.get('/hello.txt')
|
108
|
+
expect(response.body).to eq "hello!\n"
|
109
|
+
end
|
110
|
+
end
|
104
111
|
end
|
105
112
|
end
|
106
113
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zassets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -253,7 +253,7 @@ rubyforge_project:
|
|
253
253
|
rubygems_version: 1.8.23
|
254
254
|
signing_key:
|
255
255
|
specification_version: 3
|
256
|
-
summary: zassets-0.2.
|
256
|
+
summary: zassets-0.2.7
|
257
257
|
test_files:
|
258
258
|
- spec/fixtures/assets/app.js
|
259
259
|
- spec/fixtures/config/zassets.yaml
|