Sha256: d56ab5ce08884e918ef554121aea55d5a97848e446d5d5c6e46cdda63721d8e6

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe OxMlk::XML::Node, '#from' do
  before(:all) do
    @xml = xml_for(:posts)
  end
  
  it 'should parse an XML::Document' do
    data = OxMlk::XML::Document.new
    node = OxMlk::XML::Node.new(:name)
    data.root = node
    OxMlk::XML::Node.from(data).should be_a(OxMlk::XML::Node)
  end
  
  it 'should parse an XML::Node' do
    data = OxMlk::XML::Node.new(:name)
    OxMlk::XML::Node.from(data).should be_a(OxMlk::XML::Node)
  end
  
  it 'should parse a File' do
    data = File.new(@xml)
    OxMlk::XML::Node.from(data).should be_a(OxMlk::XML::Node)
  end
  
  it 'should parse a Path' do
    data = Pathname.new(@xml)
    OxMlk::XML::Node.from(data).should be_a(OxMlk::XML::Node)
  end
  
  it 'should parse a URI' do
    data = URI.parse("file:////#{File.expand_path(File.expand_path(@xml))}")
    OxMlk::XML::Node.from(data).should be_a(OxMlk::XML::Node)
  end
  
  it 'should parse a String' do
    data = File.open(@xml).read
    OxMlk::XML::Node.from(data).should be_a(OxMlk::XML::Node)
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oxmlk-0.1.0 spec/xml_spec.rb