1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/test/models/export_test.rb
Sylvain 4d2f46ca95 [feature] Async statistics export to XLSX
- fix tests due to removal of event_categories
- rake task for generating statistics
2016-07-27 11:28:54 +02:00

19 lines
750 B
Ruby

require 'test_helper'
class ExportTest < ActiveSupport::TestCase
test 'export must have a category' do
e = Export.create({export_type: 'global', user: User.first, query: '{"query":{"bool":{"must":[{"range":{"date":{"gte":"2016-06-25T02:00:00+02:00","lte":"2016-07-25T23:59:59+02:00"}}}]}}}'})
assert_raises ActiveRecord::RecordInvalid do
e.save!
end
end
test 'export generate an XLSX file' do
e = Export.create({category: 'statistics', export_type: 'global', user: User.first, query: '{"query":{"bool":{"must":[{"range":{"date":{"gte":"2016-06-25T02:00:00+02:00","lte":"2016-07-25T23:59:59+02:00"}}}]}}}'})
e.save!
VCR.use_cassette("export_generate_an_xlsx_file") do
assert_export_xlsx e
end
end
end