test/test_05_rows.rb in writeexcel-1.0.6 vs test/test_05_rows.rb in writeexcel-1.0.7

- old
+ new

@@ -18,29 +18,26 @@ def setup end def teardown - if @workbook.instance_variable_get(:@filehandle) - @workbook.instance_variable_get(:@filehandle).close(true) + if @workbook.instance_variable_get("@filehandle") + @workbook.instance_variable_get("@filehandle").close(true) end - if @worksheet.instance_variable_get(:@filehandle) - @worksheet.instance_variable_get(:@filehandle).close(true) - end end def test_1 file = StringIO.new - workbook = WriteExcel.new(file) - workbook.compatibility_mode(1) + @workbook = WriteExcel.new(file) + @workbook.compatibility_mode(1) @tests = [] # for test case 1 row = 1 col1 = 0 col2 = 0 - worksheet = workbook.add_worksheet + worksheet = @workbook.add_worksheet worksheet.set_row(row, 15) @tests.push( [ " \tset_row(): row = #{row}, col1 = #{col1}, col2 = #{col2}", { @@ -52,11 +49,11 @@ # for test case 2 row = 2 col1 = 0 col2 = 0 - worksheet = workbook.add_worksheet + worksheet = @workbook.add_worksheet worksheet.write(row, col1, 'Test') worksheet.write(row, col2, 'Test') @tests.push( [ " \tset_row(): row = #{row}, col1 = #{col1}, col2 = #{col2}", @@ -70,11 +67,11 @@ # for test case 3 row = 3 col1 = 0 col2 = 1 - worksheet = workbook.add_worksheet + worksheet = @workbook.add_worksheet worksheet.write(row, col1, 'Test') worksheet.write(row, col2, 'Test') @tests.push( [ " \twrite(): row = #{row}, col1 = #{col1}, col2 = #{col2}", @@ -87,11 +84,11 @@ # for test case 4 row = 4 col1 = 1 col2 = 1 - worksheet = workbook.add_worksheet + worksheet = @workbook.add_worksheet worksheet.write(row, col1, 'Test') worksheet.write(row, col2, 'Test') @tests.push( [ " \twrite(): row = #{row}, col1 = #{col1}, col2 = #{col2}", @@ -104,11 +101,11 @@ # for test case 5 row = 5 col1 = 1 col2 = 255 - worksheet = workbook.add_worksheet + worksheet = @workbook.add_worksheet worksheet.write(row, col1, 'Test') worksheet.write(row, col2, 'Test') @tests.push( [ " \twrite(): row = #{row}, col1 = #{col1}, col2 = #{col2}", @@ -121,11 +118,11 @@ # for test case 6 row = 6 col1 = 255 col2 = 255 - worksheet = workbook.add_worksheet + worksheet = @workbook.add_worksheet worksheet.write(row, col1, 'Test') worksheet.write(row, col2, 'Test') @tests.push( [ " \twrite(): row = #{row}, col1 = #{col1}, col2 = #{col2}", @@ -138,11 +135,11 @@ # for test case 7 row = 7 col1 = 2 col2 = 9 - worksheet = workbook.add_worksheet + worksheet = @workbook.add_worksheet worksheet.set_row(row, 15) worksheet.write(row, col1, 'Test') worksheet.write(row, col2, 'Test') @tests.push( [ @@ -152,11 +149,11 @@ :col_max => 10, } ] ) - workbook.biff_only = 1 - workbook.close + @workbook.biff_only = 1 + @workbook.close # Read in the row records rows = [] xlsfile = StringIO.new(file.string)