Sha256: 55f980c6fb2e92a104b71b08b44c3d208319b18ab5f5dac8101ac3da2bc39736

Contents?: true

Size: 745 Bytes

Versions: 5

Compression:

Stored size: 745 Bytes

Contents

# encoding: utf-8
require_relative './spec_helper'

describe ROXML::XMLRef do

  class Org
    include ROXML
    xml_accessor :fines,
                 :in   => 'policy/fines',
                 :from => 'fine',
                 :as   => { :key => 'name', :value => 'desc' }
  end

  let(:org) do
    org = Org.new
    org.fines = { 'name' => 'a fine', 'desc' => 'a desc' }
    org
  end

  let(:reference) do
    Org.roxml_attrs.first.to_ref(org)
  end

  it "should properly reconstruct wrappers with multiple elements" do

    reference.should be_a(ROXML::XMLHashRef)

    xml = ROXML::XML.new_node('org').tap do |root|
      reference.update_xml(root, org.fines)
    end

    xml_path( xml ).should == %w{org policy fines fine name}
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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