# Helpers spec references

**URL:** <https://www.ruby-forum.com/t/helpers-spec-references/141484>\
**Category:** Rails\
**Created:** [June 26, 2008, 9:38am UTC](https://www.ruby-forum.com/t/helpers-spec-references/141484 "2008-06-26T09:38:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rake\_drop\_all](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6a8cbe/32.png) [@rake\_drop\_all](https://www.ruby-forum.com/u/rake_drop_all)\
**Post date:** [June 26, 2008, 9:38am UTC](https://www.ruby-forum.com/t/helpers-spec-references/141484/1 "2008-06-26T09:38:19Z")

</div>

I saw very minimum helpers spec references on the net unless one video I  
saw on peepcode that contains one chapter talking about helpers spec,  
well the example there showed us how to stub and then should receive  
from session, model, but no example to show how to do should receive  
plain html, like so:

layout view:

\<%= top\_title %\>

application helper:

def top\_title  
content\_tag(:h1, ‘Top Title’)  
end

helper spec:

require File.dirname( **FILE** ) + ‘/…/spec\_helper’

describe ApplicationHelper do  
describe ‘top\_title’ do  
top\_title = mock(‘top\_title’)  
self.should\_receive(:top\_title).and\_return(‘Top Title’)  
end  
end

error… I’ve no idea how to do this. Please help me, I would appreciate  
anyone who can give me a solution. Thanks!

---

<div class="post-metadata">

**Author:** ![rake\_drop\_all](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6a8cbe/32.png) [@rake\_drop\_all](https://www.ruby-forum.com/u/rake_drop_all)\
**Post date:** [June 26, 2008, 8:39pm UTC](https://www.ruby-forum.com/t/helpers-spec-references/141484/2 "2008-06-26T20:39:42Z")

</div>

With rspec 1.1.4:

describe ApplicationHelper, “top\_title” do  
it “should return ‘Top Title’ in an h1” do  
helper.top\_title.should have\_tag(“h1”, “Top Title”)  
end  
end
