Sha256: 83741c8b09333d18c56c19f716417763f9b83e929a3c3bc3ab4193ebea0df913

Contents?: true

Size: 916 Bytes

Versions: 4

Compression:

Stored size: 916 Bytes

Contents

require 'spec/spec_helper'

describe ROXML::XMLAttributeRef do
  before do
    @xml = ROXML::XML::Parser.parse %(
    <myxml>
      <node name="first" />
      <node name="second" />
      <node name="third" />
    </myxml>
    )
  end
  
  context "plain vanilla" do
    before do
      @ref = ROXML::XMLAttributeRef.new(OpenStruct.new(:name => 'name', :wrapper => 'node', :array? => false), RoxmlObject.new)
    end

    it "should return one instance" do
      @ref.send(:fetch_value, @xml).should == "first"
    end
    it "should output one instance"
  end
  
  context "with :as => []" do
    before do
      @ref = ROXML::XMLAttributeRef.new(OpenStruct.new(:name => 'name', :wrapper => 'node', :array? => true), RoxmlObject.new)
    end

    it "should collect all instances" do
      @ref.send(:fetch_value, @xml).should == ["first", "second", "third"]
    end

    it "should output all instances"
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
roxml-3.1.2 spec/xml/attributes_spec.rb
roxml-3.1.1 spec/xml/attributes_spec.rb
roxml-3.1.0 spec/xml/attributes_spec.rb
ROXML-3.0.0 spec/xml/attributes_spec.rb