retrospring/spec/support/example_exporter.rb
Georg Gadinger 9413d23a02 let Zeitwerk autoload the lib/ directory
this also allows the UseCase classes to be hot reloaded in dev 🎉

- remove use_case requires (except for the exporter as Zeitwerk
  doesn't know about the subclasses)
- move version.rb to lib/retrospring so that Zeitwerk knows where
  to find Retrospring::Version
2022-12-29 20:57:28 +01:00

22 lines
825 B
Ruby

# 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