Fix helper specs

This commit is contained in:
2014-07-14 14:51:39 +02:00
parent 6420b428a7
commit 13173d0ecc
+11 -10
View File
@@ -10,26 +10,27 @@ require 'spec_helper'
# end
# end
# end
describe ApplicationHelper do
describe ApplicationHelper, type: :helper do
subject{ helper }
describe "onload_javascript" do
it "should add a normal string when given" do
onload_javascript "alert('hi')"
onload_javascript.should == "alert('hi')"
subject.onload_javascript "alert('hi')"
subject.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')"
subject.onload_javascript "alert('hi')"
subject.onload_javascript "alert('ho')"
subject.onload_javascript.should == "alert('hi');alert('ho')"
end
it "should accept a block as argument" do
onload_javascript do
subject.onload_javascript do
"alert('hi')"
end
onload_javascript.should == "alert('hi')"
subject.onload_javascript.should == "alert('hi')"
end
it "should accept a lambda as argument" do
onload_javascript ->{ "alert('hi')" }
onload_javascript.should == "alert('hi')"
subject.onload_javascript ->{ "alert('hi')" }
subject.onload_javascript.should == "alert('hi')"
end
end
end