Sha256: 564a0ef8c12855fc4e11726a7ba8cdf4a2f16275b1faa1c187cd421b7c16aa0e

Contents?: true

Size: 905 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
rspreadsheet-0.4.8 spec/xml_tied_spec.rb
rspreadsheet-0.4.7 spec/xml_tied_spec.rb