diff --git a/lib/sinatra/static_assets.rb b/lib/sinatra/static_assets.rb index 543c5e5..b9b9ab4 100644 --- a/lib/sinatra/static_assets.rb +++ b/lib/sinatra/static_assets.rb @@ -86,7 +86,7 @@ module Sinatra end def source_url_timestamp(url) - full_url = "#{Sinatra::Application.root}/public#{url}" + full_url = "#{settings.root}/public#{url}" if File.exists? full_url timestamp = File.mtime(full_url).to_i "#{url}?#{timestamp}" diff --git a/test/sinatra_static_assets_test.rb b/test/sinatra_static_assets_test.rb index 6afa937..a9a4c09 100644 --- a/test/sinatra_static_assets_test.rb +++ b/test/sinatra_static_assets_test.rb @@ -57,7 +57,7 @@ EOD end def test_tags_returns_time_stamp_when_file_exists - file_path = "#{Sinatra::Application.root}/public/bar/javascripts/summer.js" + file_path = "#{app.settings.root}/public/bar/javascripts/summer.js" File.expects(:"exists?").with(file_path).returns(true) File.expects(:mtime).with(file_path).returns(123456789)