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

Closed
wants to merge 1 commit into
from

Projects

None yet

5 participants

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!

@emk emk model_generator: Add support for Test::Unit
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.
660ad9e

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

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/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 Mar 18, 2012

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

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

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