Sha256: 280d065b80d046b3b5abc2b7a613d68277bb92b725b8e724242a3fab7b7e5c4f

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

require 'test_xml_extractor_helper'

class TestXMLExtractorJournal < Minitest::Test

  def xml_extractor_from_id(id)
    client = Puree::REST::Client.new config
    response = client.journals.find id: id
    Puree::XMLExtractor::Journal.new response.to_s
  end

  def test_initialize
    xml = '<foo/>'
    xml_extractor = Puree::XMLExtractor::Journal.new xml

    assert_instance_of Puree::XMLExtractor::Journal, xml_extractor
  end

  def test_core
    # Chemical Geology
    id = '95e40a10-1799-4e74-9a70-8b03f27d9acb'
    x = xml_extractor_from_id id

    asserts_resource x

    assert_instance_of String, x.issn
    refute_empty x.issn

    assert_instance_of Puree::Model::PublisherHeader, x.publisher
    assert_equal true, x.publisher.data?

    assert_instance_of String, x.title
    refute_empty x.title
  end

  def test_absence
    xml = '<foo/>'
    x = Puree::XMLExtractor::Journal.new xml

    assert_nil x.issn

    assert_nil x.publisher

    assert_nil x.title
  end

  def test_model
    # Chemical Geology
    id = '95e40a10-1799-4e74-9a70-8b03f27d9acb'
    x = xml_extractor_from_id id

    assert_instance_of Puree::Model::Journal, x.model
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
puree-2.5.0 test/xml_extractor/xml_extractor_journal_test.rb
puree-2.4.0 test/xml_extractor/xml_extractor_journal_test.rb
puree-2.3.0 test/xml_extractor/xml_extractor_journal_test.rb
puree-2.2.0 test/xml_extractor/xml_extractor_journal_test.rb
puree-2.1.1 test/xml_extractor/xml_extractor_journal_test.rb
puree-2.1.0 test/xml_extractor/xml_extractor_journal_test.rb
puree-2.0.0 test/xml_extractor/xml_extractor_journal_test.rb