[Rspec-devel] Using rspec with rails plugins, engines, etc.

Daniel Siemssen daniel at dr-siemssen.de
Tue Aug 29 12:16:58 EDT 2006


On 29.08.2006 17:13, Jay Levitt wrote:
> Daniel Siemssen wrote:
>   
>>>   
>>>       
>> What exactly does not get reloaded / What do you want to get reloaded?
>>     
>
> I'm writing an authentication engine with the fairly typical structure:
>
> vendor/
>    plugins/
>      myplugin/
>        lib/
>          myplugin
>            myplugin1.rb
>            myplugin2.rb
>          myplugin.rb
>
> myplugin.rb reads, as you'd expect:
>
>    require "myplugin/myplugin1"
>    require "myplugin/myplugin2"
>
> Those, in turn, populate the module Myplugin.  application.rb (and 
> myplugin.rb) include Myplugin.
>
> I'd like to be able to make changes to myplugin1.rb without having to 
> restart rails_spec_runner.
>
> It actually gets slightly trickier; myplugin1.rb borrows an idea from 
> LoginEngine, and defines the user model instance methods as a module 
> that gets dragged in by self.included.  That, in turn, uses .class_eval 
> to load the attributes, and .extend to load the class methods.
>
> If you're interested in tackling it, and if the trickiness is actually 
> tricky, I can tar up what I've got so far and send it off-list.
>
>   
>> Daniel
>> _______________________________________________
>> Rspec-devel mailing list
>> Rspec-devel at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-devel
>>     
>
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>   
Seems like the new dependencies code in edge rails / rails 1.2 will
solve that if you use it's naming convention so that your libs get
autoloaded. I don't think that it's worth to put too much time in
producing something that achieves the same.

Daniel


More information about the Rspec-devel mailing list