Sha256: 73305728ec91cefba879b0684dabda2ae28186a4ce93d3031be024c9535cdefe

Contents?: true

Size: 829 Bytes

Versions: 12

Compression:

Stored size: 829 Bytes

Contents

require 'helper.rb'

require 'yaml'

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) # rubocop:disable Security/YAMLLoad
      refute_nil(yaml)
      assert_equal(3, yaml.length)
      assert_equal(%w[dragon pickaxe rails], yaml.map { |y| y[:bibtex_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['bibtex_key'] }.sort)
      assert_equal('{The Facets of Ruby}', json[0]['series'])
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
bibtex-ruby-6.0.0 test/test_export.rb
bibtex-ruby-5.1.6 test/test_export.rb
bibtex-ruby-5.1.5 test/test_export.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/bibtex-ruby-5.1.4/test/test_export.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/bibtex-ruby-5.1.4/test/test_export.rb
bibtex-ruby-5.1.4 test/test_export.rb
bibtex-ruby-5.1.3 test/test_export.rb
bibtex-ruby-5.1.2 test/test_export.rb
bibtex-ruby-5.1.1 test/test_export.rb
bibtex-ruby-5.1.0 test/test_export.rb
bibtex-ruby-5.0.1 test/test_export.rb
bibtex-ruby-5.0.0 test/test_export.rb