[rspec-users] annotate_models plugin to annotate RSpec specs and fixture

Andrew WC Brown omen.king at gmail.com
Sun May 27 11:11:59 EDT 2007


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 


More information about the rspec-users mailing list