Permalink
Browse files

Serve static assets from Assets' @mount_path

  • Loading branch information...
1 parent d5c8ec2 commit ecac2c5f09b03b8fa41a4e9494a1e59a24ea9b34 @fgrehm fgrehm committed Apr 9, 2012
Showing with 5 additions and 4 deletions.
  1. +1 −0 lib/harbor/assets.rb
  2. +4 −4 test/assets_test.rb
View
@@ -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
@@ -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

0 comments on commit ecac2c5

Please sign in to comment.