Sha256: 102a95e7b51341d2d75e47f49a17388c558d98dbafb11609f5433a8626c12445

Contents?: true

Size: 974 Bytes

Versions: 16

Compression:

Stored size: 974 Bytes

Contents

require 'helper.rb'

require 'yaml'

module BibTeX
  class TestString < MiniTest::Unit::TestCase

    # def test_yaml_roundtrip
    #   b1 = BibTeX.open(Test.fixtures(:bibdesk))
    #   b2 = Bibliography.new(YAML.load(b1.to_yaml))
    #   assert_equal b1, b2
    # end
    
    def test_yaml
      bib = BibTeX::Bibliography.open(Test.fixtures(:bibdesk), :debug => false)
      yaml = YAML.load(bib.to_yaml)
      refute_nil(yaml)
      assert_equal(3, yaml.length)
      assert_equal(%w[ dragon pickaxe rails], yaml.map { |y| y[:key] }.sort)
      assert_equal('{The Facets of Ruby}', yaml[0][:series])
    end
  
    def test_json
      bib = BibTeX::Bibliography.open(Test.fixtures(:bibdesk), :debug => false)
      json = MultiJson.load(bib.to_json)
      refute_nil(json)
      assert_equal(3, json.length)
      assert_equal(%w[ dragon pickaxe rails], json.map { |y| y['key'] }.sort)
      assert_equal('{The Facets of Ruby}', json[0]['series'])
    end
    
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
bibtex-ruby-2.3.1 test/test_export.rb
bibtex-ruby-2.3.0 test/test_export.rb
bibtex-ruby-2.2.2 test/test_export.rb
bibtex-ruby-2.2.1 test/test_export.rb
bibtex-ruby-2.2.0 test/test_export.rb
bibtex-ruby-2.1.2 test/test_export.rb
bibtex-ruby-2.1.1 test/test_export.rb
bibtex-ruby-2.1.0 test/test_export.rb
bibtex-ruby-2.0.12 test/test_export.rb
bibtex-ruby-2.0.11 test/test_export.rb
bibtex-ruby-2.0.10 test/test_export.rb
bibtex-ruby-2.0.9 test/test_export.rb
bibtex-ruby-2.0.8 test/test_export.rb
bibtex-ruby-2.0.7 test/test_export.rb
bibtex-ruby-2.0.6 test/test_export.rb
bibtex-ruby-2.0.5 test/test_export.rb