Sha256: 3ce5f76fe8c32c203d264d22de5af41b6271c2c1db02d45c980cc51fa165a07c

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 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

describe OxMlk::XML::Node, '#value' do
  before(:all) do
    @node = OxMlk::XML::Node.new('test')
  end
  
  it 'should be the same as content' do
    @node.value.should == @node.content
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oxmlk-0.4.0 spec/xml_spec.rb
oxmlk-0.3.3 spec/xml_spec.rb
oxmlk-0.3.2 spec/xml_spec.rb
oxmlk-0.3.1 spec/xml_spec.rb
oxmlk-0.3.0 spec/xml_spec.rb