notahat / machinist

Fixtures aren't fun. Machinist is.
MIT License
1.12k stars 134 forks source link

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

Closed emk closed 8 years ago

emk commented 13 years ago

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!

dpehrson commented 12 years ago

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

lgs commented 12 years ago

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/ruby-1.9.2-p290@rails-3.2.1/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 commented 12 years ago

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

danieltdt commented 11 years ago

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

emk commented 8 years ago

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. 🙂