Sha256: 269f160c54029090c394b804f667811305548a1af63afbb3916a32ad31d42771

Contents?: true

Size: 922 Bytes

Versions: 3

Compression:

Stored size: 922 Bytes

Contents

require 'action_controller/railtie'
require 'sprockets/railtie'

class TestApp < Rails::Application
end

class AssetsTest < ActiveSupport::TestCase
  def setup
    FileUtils.mkdir_p tmp_path

    @app = TestApp.new

    @app.config.eager_load = false
    @app.config.active_support.deprecation = :stderr
    @app.config.assets.configure do |env|
      env.cache = ActiveSupport::Cache.lookup_store(:memory_store)
    end
    @app.config.assets.paths << File.expand_path('../files/assets', __FILE__)
    @app.paths['log'] = "#{tmp_path}/log/test.log"
    @app.initialize!
  end

  def teardown
    FileUtils.rm_rf tmp_path
  end

  def tmp_path
    "#{File.expand_path('../tmp', __FILE__)}"
  end

  def assets
    @app.assets
  end

  test 'LiveScript is compiled to javascript correctlly' do
    refute_nil assets['javascripts/hello.js']
    assert_match "alert('hello')", assets['javascripts/hello.js'].source
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
livescript-rails-2.0.2 test/test_assets.rb
livescript-rails-2.0.1 test/test_assets.rb
livescript-rails-2.0.0 test/test_assets.rb