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

Blog Archives

Recent Comments