Skip to content

Add request generator #1378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 25, 2015
Merged

Add request generator #1378

merged 3 commits into from
May 25, 2015

Conversation

cupakromer
Copy link
Member

This includes a generator for "request" specs. There already exists a
generator which creates these specs, but it is called "integration".
The existing name comes from the legacy implementations attempting to
mirror the Rails test style names for the RSpec equivalent specs.

Since these two generators are identical, except for the name, this
makes the new RequestGenerator a subclass of the existing
IntegrationGenerator. Alternatively, we could have decided to make
RequestGenerator the parent class, moving the existing functionality
into it. While this is arguably the "proper" way of thinking about the
generators, it could potentially break some existing applications; even
though these classes are marked private. There's no harm for now in
keeping semver compliant by making this generator additive.

Since the two generators are exactly the same this uses a shared example
to keep the specs in-sync.

Resolve #1377

This includes a generator for "request" specs. There already exists a
generator which creates these specs, but it is called "integration".
The existing name comes from the legacy implementations attempting to
mirror the Rails test style names for the RSpec equivalent specs.

Since these two generators are identical, except for the name, this
makes the new `RequestGenerator` a subclass of the existing
`IntegrationGenerator`. Alternatively, we could have decided to make
`RequestGenerator` the parent class, moving the existing functionality
into it. While this is arguably the "proper" way of thinking about the
generators, it could potentially break some existing applications; even
though these classes are marked `private`. There's no harm for now in
keeping semver compliant by making this generator additive.

Since the two generators are exactly the same this uses a shared example
to keep the specs in-sync.

Resolve #1377
This updates the existing generator specs:

- Remove old `require 'spec_helper'`; `.rspec` does this now
- Do not use the monkey patch version of `describe`
- Use the generator support macros for the shared common setup
JonRowe added a commit that referenced this pull request May 25, 2015
@JonRowe JonRowe merged commit e692909 into master May 25, 2015
@JonRowe JonRowe deleted the add-request-generator branch May 25, 2015 22:33
@JonRowe
Copy link
Member

JonRowe commented May 25, 2015

LGTM :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rspec:request generator not shown in "bin/rails g --help"
2 participants