Sha256: 5bd182b73ca4afc8fbee73133213fed1e6d7192f95058e9bdd79ba4c4ffaed4a

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 Bytes

Contents

require 'helper.rb'

require 'yaml'
require 'json'

module BibTeX
  class TestString < MiniTest::Unit::TestCase
  
    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([: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 = JSON.parse(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

3 entries across 3 versions & 1 rubygems

Version Path
bibtex-ruby-1.3.2 test/test_export.rb
bibtex-ruby-1.3.1 test/test_export.rb
bibtex-ruby-1.3.0 test/test_export.rb