spec/rspreadsheet_spec.rb in rspreadsheet-0.2.0 vs spec/rspreadsheet_spec.rb in rspreadsheet-0.2.3
- old
+ new
@@ -68,9 +68,41 @@
end
it 'can create new worksheet' do
book = Rspreadsheet.new
book.create_worksheet
end
+ it 'examples from README file are working' do
+ skip 'not implemented yet'; pending
+=begin
+
+ book = Rspreadsheet.open($test_filename)
+ sheet = book.worksheets[1]
+ sheet.B5 = 'cell value'
+
+ sheet.B5.should eq 'cell value'
+ sheet[5,2].should eq 'cell value'
+ sheet.rows(5).cells(2).value.should eq 'cell value'
+
+ expect {
+ sheet.F5 = 'text'
+ sheet[5,2] = 7
+ 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.should eq 4+7*4
+ sheet.rows(5).cells.sum{ |cell| cell.value }.should eq 4+7*4
+
+ total = 0
+ sheet.rows.each do |row|
+ expect {"Sponsor #{row[1]} with email #{row(2)} has donated #{row(3)} USD." }.not_to raise_error
+ total += row[1]
+ end
+ total.should eq 99
+=end
+ end
end