class DemoGenerator < Rails::Generators::Base
source_root File.expand_path("templates", __dir__)
def make_table
generate "migration", "create_demos_table name:string"
end
end
require "test_helper"
require "generators/demo/demo_generator"
module MyEngine
class DemoGeneratorTest < Rails::Generators::TestCase
tests DemoGenerator
destination Rails.root.join("tmp/generators")
setup :prepare_destination
test "generator runs without errors" do
assert_nothing_raised do
run_generator
end
end
end
end