Sha256: 6c820c51456b217dec5ab4c043e6799973aa6b7fdcff48a01a529f44672fb293

Contents?: true

Size: 769 Bytes

Versions: 36

Compression:

Stored size: 769 Bytes

Contents

require 'rubygems'
require 'rubyXL'

describe RubyXL::Hash do
  before do
    @xml = '<root xmlns:foo="bar"><bar hello="world"/></root>'
    @hash = {
              :root => {
                         :bar => { :attributes => { :hello => 'world' } }
                       }
            }
  end

  describe '.from_xml' do
    it 'should create a hash which correctly corresponds to XML' do
      nokogiri = RubyXL::Hash.from_xml(@xml)
      nokogiri.should == @hash
    end
  end

  describe '.xml_node_to_hash' do
    it 'should create a hash which correctly corresponds to a Nokogiri root node' do
      nokogiri = Nokogiri::XML::Document.parse(@xml)
      my_hash = RubyXL::Hash.xml_node_to_hash(nokogiri.root)
      my_hash.should == @hash[:root]
    end
  end
end

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
listen360-rubyXL-1.2.10.2 spec/lib/hash_spec.rb
listen360-rubyXL-1.2.10.1 spec/lib/hash_spec.rb
thunderboltlabs-rubyXL-1.2.10.2 spec/lib/hash_spec.rb
thunderboltlabs-rubyXL-1.2.10.1 spec/lib/hash_spec.rb
rubyXL-1.2.10 spec/lib/hash_spec.rb
rubyXL-1.2.9 spec/lib/hash_spec.rb
rubyXL-1.2.8 spec/lib/hash_spec.rb
rubyXL-1.2.7 spec/lib/hash_spec.rb
rubyXL-1.2.6 spec/lib/hash_spec.rb
rubyXL-1.2.5 spec/lib/hash_spec.rb
rubyXL-1.2.4 spec/lib/hash_spec.rb
rubyXL-1.2.3 spec/lib/hash_spec.rb
rubyXL-1.2.2 spec/lib/hash_spec.rb
rubyXL-1.2.1 spec/lib/hash_spec.rb
rubyXL-1.2.0 spec/lib/hash_spec.rb
rubyXL-1.1.12 spec/lib/hash_spec.rb
rubyXL-1.1.11 spec/lib/hash_spec.rb
rubyXL-1.1.10 spec/lib/hash_spec.rb
rubyXL-1.1.9 spec/lib/hash_spec.rb
rubyXL-1.1.8 spec/lib/hash_spec.rb