Aníbal Rojas
2007-May-27 14:45 UTC
[rspec-users] annotate_models plugin to annotate RSpec specs and fixture
I have found useful to have the table information associated to models disp?ayed in the models and fixtures files of my rails applications. If you want to add this information to the spec_fixtures and specs add the following patch to your plugin. Index: vendor/plugins/annotate_models/lib/annotate_models.rb ==================================================================--- vendor/plugins/annotate_models/lib/annotate_models.rb (revision 45) +++ vendor/plugins/annotate_models/lib/annotate_models.rb (working copy) @@ -1,7 +1,8 @@ require "config/environment" MODEL_DIR = File.join(RAILS_ROOT, "app/models") -FIXTURE_DIR = File.join(RAILS_ROOT, "test/fixtures") +SPEC_DIR = File.join(RAILS_ROOT, "spec/models") +FIXTURE_DIR = File.join(RAILS_ROOT, "spec/fixtures") module AnnotateModels @@ -75,6 +76,9 @@ model_file_name = File.join(MODEL_DIR, klass.name.underscore + ".rb") annotate_one_file(model_file_name, info) + spec_file_name = File.join(SPEC_DIR, klass.name.underscore + "_spec.rb") + annotate_one_file(spec_file_name, info) + fixture_file_name = File.join(FIXTURE_DIR, klass.table_name + ".yml") annotate_one_file(fixture_file_name, info) end -- An?bal Rojas http://www.rubycorner.com http://www.hasmanydevelopers.com
Andrew WC Brown
2007-May-27 15:11 UTC
[rspec-users] annotate_models plugin to annotate RSpec specs and fixture
Good timing, I was just thinking that annotate would be more useful in my models and fixtures. On 5/27/07, An?bal Rojas <anibal at rojas.com.ve> wrote:> > I have found useful to have the table information associated to models > disp?ayed in the models and fixtures files of my rails applications. > If you want to add this information to the spec_fixtures and specs add > the following patch to your plugin. > > Index: vendor/plugins/annotate_models/lib/annotate_models.rb > ==================================================================> --- vendor/plugins/annotate_models/lib/annotate_models.rb (revision > 45) > +++ vendor/plugins/annotate_models/lib/annotate_models.rb (working > copy) > @@ -1,7 +1,8 @@ > require "config/environment" > > MODEL_DIR = File.join(RAILS_ROOT, "app/models") > -FIXTURE_DIR = File.join(RAILS_ROOT, "test/fixtures") > +SPEC_DIR = File.join(RAILS_ROOT, "spec/models") > +FIXTURE_DIR = File.join(RAILS_ROOT, "spec/fixtures") > > module AnnotateModels > > @@ -75,6 +76,9 @@ > model_file_name = File.join(MODEL_DIR, klass.name.underscore + ".rb") > annotate_one_file(model_file_name, info) > > + spec_file_name = File.join(SPEC_DIR, klass.name.underscore + > "_spec.rb") > + annotate_one_file(spec_file_name, info) > + > fixture_file_name = File.join(FIXTURE_DIR, klass.table_name + ".yml") > annotate_one_file(fixture_file_name, info) > end > > -- > An?bal Rojas > http://www.rubycorner.com > http://www.hasmanydevelopers.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070527/d0e3b58a/attachment.html