require 'spec_helper' # Specs in this file have access to a helper object that includes # the ApplicationHelper. For example: # # describe ApplicationHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # end # end # end describe ApplicationHelper do describe "onload_javascript" do it "should add a normal string when given" do onload_javascript "alert('hi')" onload_javascript.should == "alert('hi')" end it "should concatenate separate statements correctly" do onload_javascript "alert('hi')" onload_javascript "alert('ho')" onload_javascript.should == "alert('hi');alert('ho')" end it "should accept a block as argument" do onload_javascript do "alert('hi')" end onload_javascript.should == "alert('hi')" end it "should accept a lambda as argument" do onload_javascript ->{ "alert('hi')" } onload_javascript.should == "alert('hi')" end end end