[rspec-users] Test HTML output from Rails helper

Pat Maddox pergesu at gmail.com
Sun Oct 19 12:11:37 EDT 2008


"Zach Dennis" <zach.dennis at gmail.com> writes:

> On Sat, Oct 18, 2008 at 11:34 AM, Nick Hoffman <nick at deadorange.com> wrote:
>> On 2008-10-18, at 09:16, Pat Maddox wrote:
>>>
>>> Scott Taylor <mailing_lists at railsnewbie.com> writes:
>>>>
>>>> You'd be able to write a spec like the following:
>>>>
>>>> it "should link with the correct name" do
>>>>  helper.should_receive(:link_to).with("foo", {:controller =>  "foo",
>>>> :action => "foo"})
>>>>  helper.my_method("foo")
>>>> end
>>>
>>> I don't like this, I don't think you're testing anything here.
>>>
>>> Pat
>>
>> Hi Pat. I'm interested to hear how you'd spec that helper method, because
>> some of specs are similar to what Scott proposed, and I'm always looking to
>> improve them.
>
>
> I'm pretty sure Pat is simply suggesting:
>
>   it "should link with the correct name" do
>      helper.my_method("foo").should have_tag("a[href=?]", the_path, "foo")
>   end

Yup

Pat


More information about the rspec-users mailing list