RSpec/Rails view specs and helpers
August 22nd, 2007 | 0 comments
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, a lot of the current stuff is RSpec related too