[rspec-users] include Helper in context?

Jerry West jerry.west at ntlworld.com
Wed Nov 8 04:00:37 EST 2006


PS: making it a controller spec and calling integrate_views WORKS FINE.

(Sounds of quiet sobbing)

Jerry West wrote:
>> Is this a view spec or a helper spec? If it's a view spec, it must be
>> in a views directory:
>
> It's a view spec and it is now in spec/views/account/login_spec.rb; 
> but still fails :-( . I also do not know what is actually performing 
> the render - what should I be examining in the debugger?  I've looked 
> at self (within specify) and extended it manually with the helper 
> module but to no avail.
>
> I have also tried this:
>
> class X
>  include StandardHelpers
> end
>
> context "Given a fresh login" do
>  include StandardHelpers 
>  specify 'the account/login view should ask for the user\'s email' do
>    X.new.should_respond_to 'title'       render 'account/login'
>    response.should_have_tag 'hi', :content => 'Login'
>  end
> end
>
>
> which still fails on the render but (presumably) the 
> "X.new.should_respond_to 'title'" has worked which at least shows that 
> StandardHelpers are available to be included.
>
> Weird.
>
> BTW:
>
> setup do
>  self.extend(StandardHelpers)
> end
>
> doesn't work either :-( .
>
> Many thanks,
>  Jerry
>
>> Is this a view spec or a helper spec? If it's a view spec, it must be
>> in a views directory:
>>
>> spec/views/**/*_spec.rb
>>
>> http://rspec.rubyforge.org/documentation/rails/writing/index.html
>>
>> Let us know if that solves your problem.
>>
>> Thanks,
>> David
>>
>>  
>>> # fails with:
>>> ActionView::TemplateError in 'account/login (view) displays title 
>>> "Login"'
>>> undefined method `title' for #<#<Class:0xb73154ac>:0xb7314f70>
>>> On line #1 of app/views/account/login.rhtml
>>>
>>>     1: <% title 'Login' %>              (a yield block in the layout)
>


More information about the rspec-users mailing list