Sha256: 0db23dfcedd79f0e38419cd8d45bc3fa84203dc76f006e3218e13d97abf6418a
Contents?: true
Size: 1.39 KB
Versions: 4
Compression:
Stored size: 1.39 KB
Contents
module Teabag::SpecHelper def stylesheet_link_tag_for_teabag(*sources) sources.collect do |source| asset = defined?(lookup_asset_for_path) ? lookup_asset_for_path(source, type: :stylesheet) : asset_paths.asset_for(source, "css") if asset.respond_to?(:logical_path) asset.to_a.map do |dep| stylesheet_link_tag(dep.pathname.to_s, href: asset_src(dep, source), type: "text/css").split("\n") end else stylesheet_link_tag(source) unless source.blank? end end.flatten.uniq.join("\n").html_safe end def javascript_include_tag_for_teabag(*sources) options = sources.extract_options! sources.collect do |source| asset = defined?(lookup_asset_for_path) ? lookup_asset_for_path(source, type: :javascript) : asset_paths.asset_for(source, "js") if asset.respond_to?(:logical_path) asset.to_a.map do |dep| javascript_include_tag(dep.pathname.to_s, src: asset_src(dep, options[:instrument]), type: "text/javascript").split("\n") end else javascript_include_tag(source) unless source.blank? end end.flatten.uniq.join("\n").html_safe end def asset_src(dep, instrument = false) params = "?body=1" params << "&instrument=1" if instrument && @suite && @suite.instrument_file?(dep.pathname.to_s) "#{Rails.application.config.assets.prefix}/#{dep.logical_path}#{params}" end end
Version data entries
4 entries across 4 versions & 1 rubygems