Sha256: 6957fe1daf535860daa2b56e35b9003a08f76958ec85a89dbc4f8722040fda52
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 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, '#build' do before(:all) do @node = OxMlk::XML::Node @nodes = [@node.new('one'),@node.new('two'),@node.new('three')] @attributes = [[1,2],[3,4]] @args = ['name',@nodes,@attributes] end it 'should return a new node' do @node.build(*@args).should be_a(@node) end it 'should set its name to the first argument' do @node.build(*@args).name.should == 'name' end it 'should set its children to second argument' do @node.build(*@args).children.should == @nodes end it 'should set its attributes to the third argument' do @node.build(*@args).should be_attributes 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oxmlk-0.2.3 | spec/xml_spec.rb |
oxmlk-0.2.2 | spec/xml_spec.rb |
oxmlk-0.2.1 | spec/xml_spec.rb |