Sep 232011
After having a quick look around the net (and not finding anything up to date and useful) I came up with the following basic test structure for testing my ApplicationHelper methods that served up content_for things like page titles, javascript includes, etc:
1 2 3 4 5 6 7 8 9 10 | require 'spec_helper' describe ApplicationHelper do describe "title" do it "should call content_for(:title) with the title passed" do helper.title("title stuff") helper.content_for(:title).should == "title stuff" end end end |
Great help, thanks! I had struggled to figure out how to test my content_for helpers.