Retrospring/spec/support/example_exporter.rb

23 lines
825 B
Ruby
Raw Normal View History

2022-12-09 18:28:17 -08:00
# frozen_string_literal: true
raise ArgumentError.new("This file should only be required in the 'test' environment! Current environment: #{Rails.env}") unless Rails.env.test?
# an example exporter to be used for the tests of `Exporter`
#
# this only returning basic files, nothing user-specific. each exporter should be tested individually.
class ExampleExporter < UseCase::DataExport::Base
def files = {
"textfile.txt" => "Sample Text\n",
"pictures/example.jpg" => File.read(File.expand_path("../fixtures/files/banana_racc.jpg", __dir__)),
"some.json" => json_file!(
animals: %w[raccoon fox hyena deer dog],
big_number: 3457812374589235798,
booleans: {
yes: true,
no: false,
file_not_found: nil
}
)
}
end