Fix helper specs
This commit is contained in:
@@ -10,26 +10,27 @@ require 'spec_helper'
|
|||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
describe ApplicationHelper do
|
describe ApplicationHelper, type: :helper do
|
||||||
|
subject{ helper }
|
||||||
describe "onload_javascript" do
|
describe "onload_javascript" do
|
||||||
it "should add a normal string when given" do
|
it "should add a normal string when given" do
|
||||||
onload_javascript "alert('hi')"
|
subject.onload_javascript "alert('hi')"
|
||||||
onload_javascript.should == "alert('hi')"
|
subject.onload_javascript.should == "alert('hi')"
|
||||||
end
|
end
|
||||||
it "should concatenate separate statements correctly" do
|
it "should concatenate separate statements correctly" do
|
||||||
onload_javascript "alert('hi')"
|
subject.onload_javascript "alert('hi')"
|
||||||
onload_javascript "alert('ho')"
|
subject.onload_javascript "alert('ho')"
|
||||||
onload_javascript.should == "alert('hi');alert('ho')"
|
subject.onload_javascript.should == "alert('hi');alert('ho')"
|
||||||
end
|
end
|
||||||
it "should accept a block as argument" do
|
it "should accept a block as argument" do
|
||||||
onload_javascript do
|
subject.onload_javascript do
|
||||||
"alert('hi')"
|
"alert('hi')"
|
||||||
end
|
end
|
||||||
onload_javascript.should == "alert('hi')"
|
subject.onload_javascript.should == "alert('hi')"
|
||||||
end
|
end
|
||||||
it "should accept a lambda as argument" do
|
it "should accept a lambda as argument" do
|
||||||
onload_javascript ->{ "alert('hi')" }
|
subject.onload_javascript ->{ "alert('hi')" }
|
||||||
onload_javascript.should == "alert('hi')"
|
subject.onload_javascript.should == "alert('hi')"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user