Sha256: c75c417f58e7ef934f44f3122da62278d083073537d8372140481c2d15c5aa0c

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

require "test_helper"

class ConcatenationTest < Test::Unit::TestCase
  def setup
    @concatenation = Sprockets::Concatenation.new
    @environment = environment_for_fixtures
  end
  
  def test_record
    assert_equal [], @concatenation.lines
    assert_equal "hello\n", @concatenation.record(source_file, "hello\n", 1).to_s
    assert_equal "world\n", @concatenation.record(source_file, "world\n", 2).to_s
    assert_equal ["hello\n", "world\n"], @concatenation.lines
  end
  
  def test_to_s
    @concatenation.record(source_file, "hello\n", 1)
    @concatenation.record(source_file, "world\n", 2)
    assert_equal "hello\nworld\n", @concatenation.to_s
  end
  
  def test_save_to
    filename = File.join(FIXTURES_PATH, "output.js")
    @concatenation.save_to(filename)
    assert_equal @concatenation.to_s, IO.read(filename)
    File.unlink(filename)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sprockets-foo-0.0.4 ext/sprockets_with_directives/test/test_concatenation.rb
sprockets-foo-0.0.3 ext/sprockets_with_directives/test/test_concatenation.rb
sprockets-foo-0.0.2 ext/sprockets_with_directives/test/test_concatenation.rb