RSpec/Rails view specs and helpers

August 21, 2007

I ran into a situation today where I had to mock out a helper method in a view spec. After a bit of poking around came across Jake Scruggs blog where he has a post titled, appropriately enough, Mocking/Stubbing partials and helper methods in RSpec view tests.

For the lazy, it's just:

@controller.template.should_recieve(:helper).with(var).and_return("result")

I found it useful, and maybe you will too - Jake also has some other interesting stuff on his blog, and a lot of the current stuff is RSpec related.

Comments

There are no comments for this post.

Add comment

About

I'm a programmer and shutterbug living on the West Coast of Canada.

Blog Archive

Recently Heard

Whisky & Green Teaby SupergrassPlayed on 2008/11/18 at 10:27AM
No Sant (Flytronix Mix) (feat. Lena Fiagbe)by Wasis DiopPlayed on 2008/11/18 at 10:21AM
Imperial Hippyby Transglobal UndergroundPlayed on 2008/11/18 at 10:20AM
Powered by Viviti