[rspec-users] include Helper in context?

David Chelimsky dchelimsky at gmail.com
Tue Nov 7 20:10:28 EST 2006


On 11/7/06, Jerry West <jerry.west at ntlworld.com> wrote:
> Brandon,
>
> can you get your Helpers to work in rspec 0.7 ?  I'm including them in
> the context but the render fails to see it.
>
> If you have it working, I'll go back and bang my head against it some
> more, otherwise I'll file a bug!
>
> Many thanks,
>   Jerry
>
> context "account/login (view)" do
>   include StandardHelpers
>   specify 'displays title "Login"' do
>     self.methods.should_include 'title'
>     render 'account/login'
>     response.should_have_tag 'h1', :content => 'Login'
>   end
> end

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)
>
> Note that methods.should_include 'title' passes!
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list