Sha256: 6e6b2218984409a18334fba63fda590a3851cf0833c708c5aa76bebc13f3080e

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 Bytes

Contents

require_relative './../spec_helper'

module ArraySpec
  class Book
    include ROXML
    xml_reader :id, :as => Integer
    xml_reader :title
  end

  class Store
    include ROXML
    xml_reader :books, :from => 'books', :as => [Book]
  end

  class MyXml
    include ROXML
    xml_reader :store, :as => Store
  end
end


describe ":as => []" do
  context "with plural from" do
    it "should accept the plural name as the name for each item" do
      ArraySpec::MyXml.from_xml(%(
      <myxml>
        <store>
          <books><id>1</id><title>first book</title></books>
          <books><id>2</id><title>second book</title></books>
          <books><id>3</id><title>third book</title></books>
        </store>
      </myxml>
      )).store.books.size.should == 3
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
representable-0.0.1.alpha1 spec/xml/array_spec.rb
roxml-3.1.6 spec/xml/array_spec.rb