From 6d189e3dd90bf8fca3cdf4116cb275120094cfda Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Thu, 9 Oct 2025 16:21:15 -0500 Subject: [PATCH] Update README documentation for generator Specs --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1b9f2104..2f6991d0 100644 --- a/README.md +++ b/README.md @@ -123,21 +123,26 @@ bin/rails g rolemodel:webpack Generator specs should be added to the [spec](./spec) directory. -Setup & Teardown of the test-dummy app is handled for you, but there are 2 things that each spec needs in order to work correctly. - -1. A destination directory for the test-dummy app. -2. To have your generator run against the test-dummy app. +Setup & Teardown of the test-dummy app is handled for you. All you need to do is run the provided helper method: e.g. ```ruby RSpec.describe Rolemodel::MyGenerator, type: :generator do - destination File.expand_path('tmp/', File.dirname(__FILE__)) - before { run_generator_against_test_app } end ``` +You may also provide command line arguments to the helper method as an array: + +e.g. + +```ruby +RSpec.describe Rolemodel::Testing::JasminePlaywrightGenerator, type: :generator do + before { run_generator_against_test_app(['--github-package-token=123']) } +end +``` + Additional information about testing generators and the available assertions & matchers can be found at the following resources. * [Rails Guide](https://guides.rubyonrails.org/generators.html#testing-generators)