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

Test::Unit support for 'rails generate model' #77

Closed
wants to merge 1 commit into from

Conversation

emk
Copy link

@emk emk commented Apr 19, 2011

Greetings, and thank you so much for such an excellent fixture replacement gem! I especially love the tight, painless integration between machinist and Rails 3.

One of my clients uses Test::Unit, and I discovered a small limitation when install machinist.

The existing install_generator supports both Test::Unit and RSpec,
but model_generator always assumes that our blueprints live in
spec/support/blueprints.rb.

This patch adds support for Test::Unit to model_generator. Note that
there is now a small amount of code duplication between model_generator
and install_generator that should probably by factored out into a shared
module.

No unit tests are included, because I didn't see any tests for the existing generators, and I'm not quite sure how to set them up.

If you have any suggestions on rewriting this patch to either (1) include unit tests, or (2) factor out the shared generator code, please let me know. I'll be glad to make any changes you suggest.

Once again, many thanks for your excellent gem!

The existing install_generator supports both Test::Unit and RSpec,
but model_generator always assumes that our blueprints live in
spec/support/blueprints.rb.

This patch adds support for Test::Unit to model_generator.  Note that
there is now a small amount of code duplication between model_generator
and install_generator that should probably by factored out into a shared
module.
@dpehrson
Copy link

Just ran into this as well, would be great to be able to use the machinist fixture replacement with Test::Unit

@lgs
Copy link

lgs commented Feb 27, 2012

me too

lsoave@ubuntu:~/rails/github/trends$ rails g scaffold trends 
Plural version of the model detected, using singularized version. Override with --force-plural.
      invoke  mongoid
      create    app/models/trend.rb
      invoke    rspec
      create      spec/models/trend_spec.rb
      invoke      machinist
      append        spec/support/blueprints.rb
/home/lsoave/.rvm/gems/[email protected]/gems/thor-0.14.6/lib/thor/actions/inject_into_file.rb:99:in `binread': No such file or directory - /home/lsoave/rails/github/trends/spec/support/blueprints.rb (Errno::ENOENT)

@jmbejar
Copy link

jmbejar commented Mar 18, 2012

Got the same problem because I'm using minitest instead of rspec :(

@danieltdt
Copy link

@notahat any thoughts about this patch? I got the same problem here :/

@emk
Copy link
Author

emk commented Sep 18, 2016

This PR is now many years old, and I can't imagine that it still has any relevancy in the fast-moving world of Rails. Closing. 🙂

@emk emk closed this Sep 18, 2016
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.

5 participants