Skip to content

Array attributes silently accept single arguments, then blow up on write #2

@dmolesUC

Description

@dmolesUC

Steps to reproduce:

resource = Resource.new(
  identifier: Identifier.new(value: '10.5555/12345678'),
  creators: [
    Creator.new(
      name: 'Josiah Carberry',
      identifier: NameIdentifier.new(scheme: 'ORCID', scheme_uri: URI('http://orcid.org/'), value: '0000-0002-1825-0097'),
      affiliations: 'Department of Psychoceramics, Brown University' # should be an array
    )
  ],
  titles: [
    Title.new(value: 'Toward a Unified Theory of High-Energy Metaphysics: Silly String Theory')
  ],
  publisher: 'Journal of Psychoceramics',
  publication_year: 2008
)
resource.write_xml

Expected:

  • error from Creator initializer, or perhaps silent conversion to array

Actual:

  • stack trace:
NoMethodError: undefined method `each' for "Department of Psychoceramics, Brown University":String
    from /Users/dmoles/.rvm/gems/ruby-2.2.3/gems/xml-mapping-0.10.0/lib/xml/mapping/standard_nodes.rb:285:in `set_attr_value'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions