Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down