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
On Jun 25, 11:57 pm, rake drop all
<rakedrop...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---