Sha256: 2efe0d0ddd4e6e9b79e45faf0d5078d5e378cf6e2de2fd6451c03230bf1cdf54

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

require 'test_helper'

class WrongDirectoryTest < Test::Unit::TestCase

  def setup
    @original_dir ||= File.expand_path(Dir.pwd)
    Dir.chdir('/')
  end

  def teardown
    Dir.chdir(@original_dir)
  end

  def test_fetching_lists_of_individual_urls
    urls = Jammit.packager.individual_urls(:test, :css)
    assert urls == ['/fixtures/src/test1.css', '/fixtures/src/test2.css', '/fixtures/src/test_fonts.css']
    urls = Jammit.packager.individual_urls(:test, :js)
    assert urls == ['/fixtures/src/test1.js', '/fixtures/src/test2.js']
  end

  def test_packaging_stylesheets
    css = Jammit.packager.pack_stylesheets(:test)
    assert css == File.read("#{ASSET_ROOT}/fixtures/jammed/test.css")
    css = Jammit.packager.pack_stylesheets(:test, :datauri)
    assert css == File.read("#{ASSET_ROOT}/fixtures/jammed/test-datauri.css")
    css = Jammit.packager.pack_stylesheets(:test, :mhtml, 'http://www.example.com')
    assert css == File.open("#{ASSET_ROOT}/fixtures/jammed/test-mhtml.css", 'rb') {|f| f.read }
  end

  def test_packaging_javascripts
    js = Jammit.packager.pack_javascripts(:test)
    assert js == File.read("#{ASSET_ROOT}/fixtures/jammed/test.js")
  end

  def test_packaging_templates
    jst = Jammit.packager.pack_templates(:test)
    assert jst == File.read("#{ASSET_ROOT}/fixtures/jammed/test.jst")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jammit-core-0.1.1 test/unit/test_in_the_wrong_directory.rb
jammit-core-0.1.0 test/unit/test_in_the_wrong_directory.rb