-
Notifications
You must be signed in to change notification settings - Fork 44
/
xlsx_freeze_test.rb
44 lines (34 loc) · 909 Bytes
/
xlsx_freeze_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require "test_helper"
class XlsxFreezeTest < ActiveSupport::TestCase
def setup
@options = {
headers: [
['Latest Posts'],
['Title','Category','Author','Posted on','Posted At','Earnings']
],
data: 50.times.map{|i| [i, "foobar-#{i}", 5.4*i, true, Date.today, Time.now]},
}
end
def teardown
end
def test_1
opts = @options.merge({
freeze: {rows: 1, columns: 1},
})
# Using Array Data
file_data = SpreadsheetArchitect.to_xlsx(opts)
File.open(VERSIONED_BASE_PATH.join("freeze_test_1.xlsx"),'w+b') do |f|
f.write file_data
end
end
def test_2
opts = @options.merge({
freeze: {rows: (2..4), columns: (2..4)},
})
# Using Array Data
file_data = SpreadsheetArchitect.to_xlsx(opts)
File.open(VERSIONED_BASE_PATH.join("freeze_test_2.xlsx"),'w+b') do |f|
f.write file_data
end
end
end