diff --git a/config/generators.yml b/config/generators.yml index 518439f..32f706e 100644 --- a/config/generators.yml +++ b/config/generators.yml @@ -70,6 +70,10 @@ factory_bot_rails: description: "Install and configure factory_bot_rails gem" requires: active_record +github_pr_template: + prompt: "GitHub PR template" + description: "Add GitHub pull request template" + git_safe: good_migrations: diff --git a/lib/nextgen/generators/github_pr_template.rb b/lib/nextgen/generators/github_pr_template.rb new file mode 100644 index 0000000..9c443f4 --- /dev/null +++ b/lib/nextgen/generators/github_pr_template.rb @@ -0,0 +1 @@ +template ".github/PULL_REQUEST_TEMPLATE.md.tt" diff --git a/template/.github/PULL_REQUEST_TEMPLATE.md.tt b/template/.github/PULL_REQUEST_TEMPLATE.md.tt new file mode 100644 index 0000000..421d768 --- /dev/null +++ b/template/.github/PULL_REQUEST_TEMPLATE.md.tt @@ -0,0 +1,21 @@ +Problem +======= + + + + + +Solution +======== + +Steps to verify +--------------- + +1. step +1. step +1. step +<% if File.exist?("app/views/layouts/application.html.erb") -%> + +Screenshots +----------- +<% end -%> diff --git a/test/nextgen/generators/github_pr_template_test.rb b/test/nextgen/generators/github_pr_template_test.rb new file mode 100644 index 0000000..0c42293 --- /dev/null +++ b/test/nextgen/generators/github_pr_template_test.rb @@ -0,0 +1,11 @@ +require_relative "test_case" + +class Nextgen::Generators::GithubPrTemplateTest < Nextgen::Generators::TestCase + destination File.join(Dir.tmpdir, "test_#{SecureRandom.hex(8)}") + setup :prepare_destination + + test "creates a .github/PULL_REQUEST_TEMPLATE.md file" do + apply_generator + assert_file ".github/PULL_REQUEST_TEMPLATE.md" + end +end