Add permanent URLs for JS and CSS asset bundles

pull/220/head
Thibaut 10 years ago
parent 438c1940a5
commit 4954dc688b

@ -172,8 +172,12 @@ class App < Sinatra::Application
200 200
end end
get '/docs.json' do %w(docs.json application.js application.css).each do |asset|
redirect asset_path('docs.json', protocol: 'http') class_eval <<-CODE, __FILE__, __LINE__ + 1
get '/#{asset}' do
redirect asset_path('#{asset}', protocol: 'http')
end
CODE
end end
get '/s/maxcdn' do get '/s/maxcdn' do

@ -181,6 +181,22 @@ class AppTest < MiniTest::Spec
end end
end end
describe "/application.js" do
it "returns to the asset path" do
get '/application.js'
assert last_response.redirect?
assert_equal 'http://example.org/assets/application.js', last_response['Location']
end
end
describe "/application.css" do
it "returns to the asset path" do
get '/application.css'
assert last_response.redirect?
assert_equal 'http://example.org/assets/application.css', last_response['Location']
end
end
describe "/feed" do describe "/feed" do
it "returns an atom feed" do it "returns an atom feed" do
get '/feed' get '/feed'

Loading…
Cancel
Save