spec/worksheet_spec.rb in rspreadsheet-0.2.15 vs spec/worksheet_spec.rb in rspreadsheet-0.3
- old
+ new
@@ -1,26 +1,33 @@
require 'spec_helper'
+using ClassExtensions if RUBY_VERSION > '2.1'
describe Rspreadsheet::Worksheet do
describe "from test workbook file" do
before do
@sheet = Rspreadsheet.new($test_filename).worksheets(1)
end
it 'contains nonempty xml in rows for testfile' do
@sheet.rows(1).xmlnode.elements.size.should be >1
end
it 'uses detach_my_subnode_respect_repeated well' do
- @sheet.detach_my_subnode_respect_repeated(50, {:xml_items_node_name => 'table-row', :xml_repeated_attribute => 'number-rows-repeated'})
- @sheet.rows(50).detach_my_subnode_respect_repeated(12, {:xml_items_node_name => 'table-cell', :xml_repeated_attribute => 'number-columns-repeated'})
+ @sheet.cell(50,12).mode.should_not == :regular
+ @sheet.detach_my_subnode_respect_repeated(50)
+ @sheet.rows(50).detach_my_subnode_respect_repeated(12)
+ @sheet.cell(50,12).mode.should == :regular
end
end
end
describe Rspreadsheet::Worksheet do
describe "newly created" do
before do
@book = Rspreadsheet.new
@sheet = @book.create_worksheet
+ end
+ it 'array of rows is empty Array' do
+ @sheet.subitems_array.should == []
+ @sheet.images.count.should == 0
end
it 'has correctly namespaced xmlnode' do
@xmlnode = @sheet.xmlnode
@xmlnode.namespaces.to_a.size.should >5
@xmlnode.namespaces.find_by_prefix('office').should_not be_nil