Sha256: e148807bd20b6a730d4fa3a42895cfa7c28032c8577355ed003129f1aefda6d5
Contents?: true
Size: 1.89 KB
Versions: 18
Compression:
Stored size: 1.89 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'sinatra/classy_assets' class ClassySinatraApp < Sinatra::Base use Rack::ClassyAssets register Sinatra::ClassyAssets get "/stylesheet_tag" do slim :stylesheet_tag end get "/stylesheet_tag_media" do slim :stylesheet_tag_media end get "/javascript_tag" do slim :javascript_tag end template :index do "| Classy Assets" end template :layout do "html\n\tbody\n\t\t==yield\n" end template :stylesheet_tag do "==stylesheet_tag('application')" end template :stylesheet_tag_media do "==stylesheet_tag('application', media: 'print')" end template :javascript_tag do "==javascript_tag('application')" end end def app ClassySinatraApp.new end describe Sinatra::ClassyAssets do before do ClassyAssets.config do |config| config.asset_root = File.expand_path('../../support', __FILE__) config.asset_debug = false config.asset_digest = false config.asset_host = nil config.asset_paths = Dir.glob(File.join(config.asset_root, config.asset_prefix, '*')) end end context "sprockets.context_class" do it "resolves the url to the asset" do get "/assets/application.css" last_response.body.must_match(/background-url: "\/assets\/image.png";/) end end context "Helpers" do it "outputs a stylesheet link tag" do get "/stylesheet_tag" last_response.body.must_match(/<link href="\/assets\/application.css" media="screen" rel="stylesheet">/) end it "outputs the stylesheet tag with the correct media attribute" do get "/stylesheet_tag_media" last_response.body.must_match(/<link href="\/assets\/application.css" media="print" rel="stylesheet">/) end it "outputs a javascript tag" do get "/javascript_tag" last_response.body.must_match(/<script src="\/assets\/application.js"><\/script>/) end end end
Version data entries
18 entries across 18 versions & 1 rubygems