Better regression tests for roo

This commit is contained in:
Andy Meneely
2015-04-27 08:50:03 -04:00
parent d00ae0215f
commit 25773a8ee5
7 changed files with 32 additions and 4 deletions
+19
View File
@@ -28,4 +28,23 @@ describe Squib::Deck do
})
end
end
context '#xlsx' do
it 'loads basic xlsx data' do
expect(Squib.xlsx(file: xlsx_file('basic.xlsx'))).to eq({
'Name' => %w(Larry Curly Mo),
'General Number' => %w(1 2 3), #general types always get loaded as strings with no conversion
'Actual Number' => [4.0, 5.0, 6.0], #numbers get auto-converted to integers
})
end
it 'loads xlsx with formulas' do
expect(Squib.xlsx(file: xlsx_file('formulas.xlsx'))).to eq({
'A' => %w(1, 2),
'B' => %w(3, 4),
'Sum' => %w(4, 6),
})
end
end
end
Binary file not shown.
Binary file not shown.
+4
View File
@@ -32,6 +32,10 @@ def csv_file(file)
"#{File.expand_path(File.dirname(__FILE__))}/data/csv/#{file}"
end
def xlsx_file(file)
"#{File.expand_path(File.dirname(__FILE__))}/data/xlsx/#{file}"
end
def overwrite_sample(sample_name, log)
# Use this to overwrite the regression with current state
File.open(sample_regression_file(sample_name), 'w+:UTF-8') do |f|