Sha256: 18ace6f5b34f8855031fa9c772648656c417597794dd9631d2e4931a701adf2a

Contents?: true

Size: 770 Bytes

Versions: 5

Compression:

Stored size: 770 Bytes

Contents

require '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

5 entries across 5 versions & 1 rubygems

Version Path
roxml-3.3.1 spec/xml/array_spec.rb
roxml-3.3.0 spec/xml/array_spec.rb
roxml-3.2.2 spec/xml/array_spec.rb
roxml-3.2.1 spec/xml/array_spec.rb
roxml-3.2.0 spec/xml/array_spec.rb