[rspec-devel] [ rspec-Bugs-6713 ] helper methods not rendered in view tests?

noreply at rubyforge.org noreply at rubyforge.org
Sun Nov 19 10:29:21 EST 2006


Bugs item #6713, was opened at 2006-11-16 17:34
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6713&group_id=797

>Category: rails plugin
Group: None
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Micah Martin (slagyr)
>Assigned to: David Chelimsky (dchelimsky)
Summary: helper methods not rendered in view tests?

Initial Comment:
Apprently helpers are not rendered in view tests...

template _xyz:
<div>
	<% form_remote_tag :update => "some_div", :url => {:action => :something } %>
		<textarea style="width: 100%" rows="2">Enter text here.</textarea>
	<% end_form_tag %>
</div>


failing spec:
  specify "Form is rendered" do
    
    render "/controller/_xyz"
    response.should_have_tag 'form', :parent => { :tag => "div" }
  end

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2006-11-19 15:29

Message:
Fixed in trunk (rev 1123).

Docs coming soon....

Basically:

the view spec does the following:

1. tries to include an implicit helper. For example:

render 'person/show'

would try to include PersonHelper

2. includes any specified helper

render 'person/show', :helper => 'AddressHelper'
render 'person/show', :helpers => ['AddressHelper','ZipCodeHelper']

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2006-11-19 15:26

Message:
moving this to Bugs

----------------------------------------------------------------------

Comment By: Micah Martin (slagyr)
Date: 2006-11-17 17:31

Message:
The above example has a mistake... the form_remote_tag tag is missing an =.

Still, custom helper methods are not being resolved in view specs.

For example if I have in app/helpers/controller_helper.rb:

def my_helper
 return "blah"
end

And in my template I use:

<%= my_helper  %>

The view tests will throw an error:

undefined method `my_helper' for #<#<Class:0x2691bc0>:0x2691a80>

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6713&group_id=797


More information about the rspec-devel mailing list