require File.expand_path('../test_helper', __FILE__) class AppTest < UnitTest test '/js/hello.js (plain js)' do get '/js/hello.js' assert body == '$(function() { alert("Hello"); });' end test '/js/hi.js (coffeescript)' do get '/js/hi.js' assert body.include? 'yo' assert body.include? 'x = function' end test '/js/hi.css (404)' do get '/js/hi.css' assert last_response.status == 404 end test '/js/hi.2834987.js (with cache buster)' do get '/js/hello.283947.js' assert body == '$(function() { alert("Hello"); });' end test '/js/hi.2834987.js (coffeescript with cache buster)' do get '/js/hi.283947.js' assert last_response.status == 200 assert body.include? 'yo' assert body.include? 'x = function' end test 'wrong extension for static file' do get '/js/hello.css' assert last_response.status == 404 end test 'wrong extension for dynamic coffeescript file' do get '/js/hi.css' assert last_response.status == 404 end test 'static css' do get '/css/style.css' assert body.include?('div { color: red; }') end test 'sass' do get '/css/screen.css' assert body =~ /background.*rgba.*255.*0.3/m end test "match" do files = app.assets.files assert files['/css/screen.css'] =~ /app\/css\/screen.sass/ assert files['/js/hi.js'] =~ /app\/js\/hi.coffee/ end test "helpers" do get '/index.html' assert body =~ /