Skip to content
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

Cannot generate a generator spec when generating a generator #2084

Closed
tragiclifestories opened this issue Feb 26, 2019 · 4 comments
Closed

Comments

@tragiclifestories
Copy link

(Sorry for the crazy Dr Seuss issue name - and sorry if this has been reported before, it's very difficult to search for ... )

What Ruby, Rails and RSpec versions are you using?

Ruby version: 2.5.3p105
Rails version: 5.2.2
Rspec version: 3.8

  • rspec-core 3.8.0
  • rspec-expectations 3.8.2
  • rspec-mocks 3.8.0
  • rspec-rails 3.8.2
  • rspec-support 3.8.0

Observed behaviour

With RSpec as the project-wide default test framework, rails generate generator always errors out.

$ bin/rails g generator foobar
Running via Spring preloader in process 45230
      create  lib/generators/foobar
      create  lib/generators/foobar/foobar_generator.rb
      create  lib/generators/foobar/USAGE
      create  lib/generators/foobar/templates
       error  rspec [not found]

I think this is because there is not a generator spec generator, so the rails generator generator is looking for something that isn't there.

Expected behaviour

A spec/lib/generators/foobar_generator_spec.rb file is generated with the helpers from spec/support/generators (run_generator and friends) available (I guess that would need to be required in spec_helper by default as well).

Can you provide an example app?

https://github.com/tragiclifestories/rspec-generator-issue

@tragiclifestories
Copy link
Author

Digging around I discovered that this project is using ammeter which has solved my immediate problem. However, it would still be nice if RSpec would generate a spec file on rails g generator foo ... I leave it to you folks to decide whether it's worth the time to implement.

@JonRowe
Copy link
Member

JonRowe commented Feb 26, 2019

This would be a great easy PR for someone, you can either use one of our existing templates to produce this or you can make it skip.

@ConSou
Copy link
Contributor

ConSou commented Feb 26, 2019

I can work on this issue.

@JonRowe
Copy link
Member

JonRowe commented Mar 2, 2019

Generator spec generators are now available on master.

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

No branches or pull requests

3 participants