Fix helper specs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user