Open jduss4 opened 5 years ago
Just looked into it a little and this was starting to work, although I'm not sure what the destination needs to be or if there's a better way to load the generator class:
require 'test_helper'
require_relative '../lib/generators/setup_generator.rb'
# NOTE can find more specific assertions and methods for generator tests here:
# https://api.rubyonrails.org/classes/Rails/Generators/TestCase.html
class SetupGeneratorTest < Rails::Generators::TestCase
tests SetupGenerator
destination File.expand_path("../tmp", __dir__)
setup :prepare_destination
end
Looks promising. I knew Rails had tests for its own generators, so we can probably look at their tests for reference too
https://api.rubyonrails.org/v5.2.3/classes/Rails/Generators/TestCase.html
We can potentially test the setup step internally within orchid instead of always having to fire up a new application each time