spec/rspreadsheet_spec.rb in rspreadsheet-0.2.14 vs spec/rspreadsheet_spec.rb in rspreadsheet-0.2.15
- old
+ new
@@ -1,7 +1,6 @@
require 'spec_helper'
-using ClassExtensions if RUBY_VERSION > '2.1'
describe Rspreadsheet do
it 'can open ods testfile and reads its content correctly' do
book = Rspreadsheet.new($test_filename)
s = book.worksheets(1)
@@ -24,29 +23,10 @@
@sheet1.nonemptycells.each do |cell| # and test identity
@sheet2[cell.rowi,cell.coli].should == cell.value
end
end
- it 'can open and save file, and saved file is exactly same as original' do
- tmp_filename = '/tmp/testfile1.ods' # first delete temp file
- File.delete(tmp_filename) if File.exists?(tmp_filename)
- book = Rspreadsheet.new($test_filename) # than open test file
- book.save(tmp_filename) # and save it as temp file
-
- # now compare them
- @content_xml1 = Zip::File.open($test_filename) do |zip|
- LibXML::XML::Document.io zip.get_input_stream('content.xml')
- end
- @content_xml2 = Zip::File.open(tmp_filename) do |zip|
- LibXML::XML::Document.io zip.get_input_stream('content.xml')
- end
-
- @content_xml2.root.first_diff(@content_xml1.root).should be_nil
- @content_xml1.root.first_diff(@content_xml2.root).should be_nil
-
- @content_xml1.root.should == @content_xml2.root
- end
it 'when open and save file modified, than the file is different' do
tmp_filename = '/tmp/testfile1.ods' # first delete temp file
File.delete(tmp_filename) if File.exists?(tmp_filename)
book = Rspreadsheet.new($test_filename) # than open test file
book.worksheets(1).rows(1).cells(1).value.should_not == 'xyzxyz'
@@ -86,10 +66,10 @@
sheet.cells(5,2).value = 1.78
sheet.cells(5,2).format.bold = true
sheet.cells(5,2).format.background_color = '#FF0000'
}.not_to raise_error
-
+
sheet.rows(4).cellvalues.sum{|val| val.to_f}.should eq 4+7*4
sheet.rows(4).cells.sum{ |cell| cell.value.to_f }.should eq 4+7*4
total = 0
sheet.rows.each do |row|