Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Serve static assets from Assets' @mount_path

  • Loading branch information...
commit ecac2c5f09b03b8fa41a4e9494a1e59a24ea9b34 1 parent d5c8ec2
@fgrehm fgrehm authored
Showing with 5 additions and 4 deletions.
  1. +1 −0  lib/harbor/assets.rb
  2. +4 −4 test/assets_test.rb
View
1  lib/harbor/assets.rb
@@ -39,6 +39,7 @@ def cascade
end
def find_file(file)
+ file = file.gsub("#{@mount_path}/", '')
pattern = "{#{paths.join(',')}}/#{file}"
Dir[pattern].first
end
View
8 test/assets_test.rb
@@ -23,22 +23,22 @@ def test_cascades_self_if_serve_static
end
def test_does_not_match_if_not_enabled_to_serve_static
- refute @assets.match(stub_request('public-file'))
+ refute @assets.match(stub_request('assets/public-file'))
end
def test_matches_static_assets
@assets.serve_static = true
- assert @assets.match(stub_request('public-file'))
+ assert @assets.match(stub_request('assets/public-file'))
end
def test_searches_on_multiple_paths
@assets.serve_static = true
- assert @assets.match(stub_request('public-file-2'))
+ assert @assets.match(stub_request('assets/public-file-2'))
end
def test_return_nil_if_no_match_is_found
@assets.serve_static = true
- refute @assets.match(stub_request('public-file-3'))
+ refute @assets.match(stub_request('assets/public-file-3'))
end
def test_caches_and_stream_file
Please sign in to comment.
Something went wrong with that request. Please try again.