Sha256: 4c1cef0e74ed6bab7b33118a5856bb68dd0a1ea3c63b7487bda7dc14ad5d86cc

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

require "test_helper"

class OutputFileTest < Test::Unit::TestCase
  def setup
    @output_file = Sprockets::OutputFile.new
    @environment = environment_for_fixtures
  end
  
  def test_record
    assert_equal [], @output_file.source_lines
    assert_equal "hello\n", @output_file.record(source_line("hello\n")).to_s
    assert_equal "world\n", @output_file.record(source_line("world\n")).to_s
    assert_equal ["hello\n", "world\n"], @output_file.source_lines.map { |source_line| source_line.to_s }
  end
  
  def test_to_s
    @output_file.record(source_line("hello\n"))
    @output_file.record(source_line("world\n"))
    assert_equal "hello\nworld\n", @output_file.to_s
  end
  
  def test_save_to
    filename = File.join(FIXTURES_PATH, "output.js")
    @output_file.save_to(filename)
    assert_equal @output_file.to_s, IO.read(filename)
    File.unlink(filename)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sstephenson-sprockets-0.3.0 test/test_output_file.rb
sstephenson-sprockets-0.4.0 test/test_output_file.rb
sstephenson-sprockets-0.5.0 test/test_output_file.rb