Sha256: 828651c367f1d9128bf22e0465d6567cd62ad01775a9bf5312e89f6717b46d12

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

module Teabag::SpecHelper
  def javascript_include_tag_for_teabag(*sources)
    options = sources.extract_options!
    debug   = options.key?(:debug)  ? options.delete(:debug)  : debug_assets?
    body    = options.key?(:body)   ? options.delete(:body)   : false
    digest  = options.key?(:digest) ? options.delete(:digest) : digest_assets?

    foo = sources.collect do |source|
      if asset = asset_paths.asset_for(source, 'js')
        asset.to_a.map { |dep|
          javascript_include_tag(dep.pathname.to_s, { :src => path_to_asset(dep, :ext => 'js', :body => true, :digest => digest) }.merge!(options))
        }
      else
        javascript_include_tag(source.to_s, { :src => path_to_asset(source, :ext => 'js', :body => true, :digest => digest) }.merge!(options))
      end
    end
    foo.flatten.uniq.join("\n").html_safe
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teabag-0.3.5 app/helpers/teabag/spec_helper.rb