Sha256: da6acaf51e670d42dbeb7e6f434a746495135920d1105200d0b03d400f5717d7

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

require 'spec_helper'
require 'rspreadsheet/xml_tied_array'

describe Rspreadsheet::XMLTiedArray do
	before do
		@book = Rspreadsheet.new
		@sheet = @book.create_worksheet
    class TestXMLTiedArray 
      include Rspreadsheet::XMLTiedArray
    end
	end
  it 'method subitems does not accept 2 parameteres' do
    expect {@sheet.subitems(1,2)}.to raise_error ArgumentError
  end
  it 'does not have xmlnode method by default' do
    tx = TestXMLTiedArray.new
    expect {tx.xmlnode}.to raise_error
  end
  
  it 'raises when prepare_empty_xmlnode fails in insert_new_empty_subnode_before' do
    class TestXMLTiedArray 
      def subitem_xml_options; {} end
      def xmlnode; nil end
    end
    
    tx = TestXMLTiedArray.new
    expect {tx.insert_new_empty_subnode_before(0)}.to raise_error IndexError
    expect {tx.insert_new_empty_subnode_before(1)}.to raise_error /create empty xmlnode/
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspreadsheet-0.4.5 spec/xml_tied_spec.rb