[rspec-users] Build rspec-rails as a gem?

Pat Maddox pergesu at gmail.com
Tue Jun 3 02:32:44 EDT 2008


On Mon, Jun 2, 2008 at 11:23 PM, Jose Fernandez <lists at ruby-forum.com> wrote:
> Pat Maddox wrote:
>> On Mon, Jun 2, 2008 at 11:16 PM, Jose Fernandez <lists at ruby-forum.com>
>> wrote:
>>> So how can I test a mocked rails controller within my plugin's specs?
>>
>> I don't quite follow you.  Can you post an example of what you're trying
>> to do?
>>
>> Pat
>
> http://github.com/jfernandez/submarine/tree/b3853cb0a959813f156bb25239dcd4f4f2c0c406/spec/submarine/submarine_spec.rb
>
> That only test wont work because neither the 'controller_name' or 'get'
> methods are recognized, and I think thats because they are part of
> rspec-rails.

You need to include the app's spec-helper from within your spec.
http://github.com/pat-maddox/rspec-plugin-generator/tree/master/generators/rspec_plugin/templates/spec_helper.rb
shows what I did in my rspec_plugin generator.

You might just be able to require spec/rails, I'm not sure, but you'd
have to set up the load path.

Pat


More information about the rspec-users mailing list