Sha256: ebf7abfa901ea10a7a4bc3ef603974f5ede79633bd3317085c7e40a8f79f7bb0

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

require 'helper'

class TestExtraOutputs < Test::Unit::TestCase
  def test_mysql2json_to_s
    a = Mysql2xxxx::JSON.new @options
    str = a.to_s
    assert str.include?('Acura')
    assert !str.include?('DaimlerChrysler')    
  end
  
  def test_mysql2json_to_path
    path = '/tmp/test_mysql2json_to_path'
    a = Mysql2xxxx::JSON.new @options
    a.to_path path
    assert File.read(path).include?('Acura')
    assert !File.read(path).include?('DaimlerChrysler')
  end
  
  def test_mysql2json_to_file
    f = File.open('/tmp/test_mysql2json_to_file', 'w')
    a = Mysql2xxxx::JSON.new @options
    a.to_file f
    f.close
    assert File.read(f.path).include?('Acura')
    assert !File.read(f.path).include?('DaimlerChrysler')
  end
  
  def test_mysql2json_to_stdout
    a = Mysql2xxxx::JSON.new @options
    begin
      require 'stringio'
      old_stdout = $stdout
      my_stdout = StringIO.new
      $stdout = my_stdout
      a.to_stdout
      $stdout = old_stdout
      my_stdout.rewind
      assert my_stdout.read.include?('Acura')
      assert !my_stdout.read.include?('DaimlerChrysler')
    ensure
      $stdout = old_stdout
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mysql2xxxx-0.2.1 test/test_extra_outputs.rb
mysql2xxxx-0.2.0 test/test_extra_outputs.rb
mysql2xxxx-0.1.1 test/test_extra_outputs.rb
mysql2xxxx-0.1.0 test/test_extra_outputs.rb
mysql2xxxx-0.0.4 test/test_extra_outputs.rb
mysql2xxxx-0.0.3 test/test_extra_outputs.rb
mysql2xxxx-0.0.2 test/test_extra_outputs.rb
mysql2xxxx-0.0.1 test/test_extra_outputs.rb