[rspec-users] rSpec'ing Plugins

s.ross cwdinfo at gmail.com
Tue Jun 12 21:29:35 EDT 2007


Thanks, this is a great starting point.

Steve

On Jun 12, 2007, at 6:23 PM, Luis Lavena wrote:

> On 6/12/07, s.ross <cwdinfo at gmail.com> wrote:
>> I'm refactoring some of my code into a plugin and while it passes the
>> base specs (as though it were part of the Rails app), I'd prefer that
>> the plugin's specs live in the vendor/plugins/myplugin directory.
>>
>> Here's where I'm getting stuck. The plugin is MVC so instead of
>> touching one part of Rails, it relies on several (model, view,
>> controller) to work. That means to spec it requires rspec_on_rails.
>> So, my questions are:
>>
>> 1. Is anyone doing this?
>
> Yes, at least the M with plugins playing with Models.
>
> I just created a spec folder, a spec_helper.rb inside of it and some
> Fixtured Models, Database schema.
>
> I used that approach to pluginize some code of one application.
>
> Specs inside the plugin will be independent of models located in your
> application, so:
>
> app/models/user.rb will not clash with #{my_plugin}/spec/fixtures/ 
> models/user.rb
>
> in that way, I isolate the plugin functionality and his behavior.
>
> This is the pastie for my spec_helper inside plugin/spec folder:
>
> http://pastie.caboo.se/69984
>
>
>> 2. Was it worth the effort or is Test::Unit easier for this kind of
>> thing?
>>
>> I'd be happy if I could even get a model spec to pass, but I keep
>> getting version mismatches between spec and rspec_on_rails even
>> though I've done fresh gem install and plugin installs.
>>
>
> I don't know about that, I'm stuck at 0.9.4 gem + plugins until
> migrate some of these applications.
>
>> Any thoughts appreciated. I'd far prefer to use only rSpec on this
>> project.
>
> -- 
> Luis Lavena
> Multimedia systems
> -
> Leaders are made, they are not born. They are made by hard effort,
> which is the price which all of us must pay to achieve any goal that
> is worthwhile.
> Vince Lombardi
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Steve Ross
sross at calicowebdev.com
http://www.calicowebdev.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070612/4a503c1f/attachment.html 


More information about the rspec-users mailing list