spec/innate/helper.rb in innate-2010.07 vs spec/innate/helper.rb in innate-2011.01
- old
+ new
@@ -14,10 +14,16 @@
module FrownHelper
def frown
':('
end
end
+
+ module FooBarHelper
+ def self.baz
+ "baz"
+ end
+ end
end
end
class HelperNodeExpose
include Innate::Node
@@ -58,11 +64,11 @@
end
should 'construct link from ::a' do
FNL.a(:index).should == '<a href="/foo/index">index</a>'
FNL.a('index', :index, :x => :y).should == '<a href="/foo/index?x=y">index</a>'
- FNL.a('duh/bar', 'duh/bar', :x => :y).should == '<a href="/foo/duh/bar?x=y">duh/bar</a>'
+ FNL.a('duh/bar', 'duh/bar', :x => :y).should == "<a href=\"/foo/duh/bar?x=y\">duh/bar</a>"
FNL.a('foo', :/, :x => :y).should == '<a href="/foo/?x=y">foo</a>'
end
should 'return module when Module is given to #each' do
Innate::HelpersHelper.each_extend(self, Innate::Helper::Link) do |p|
@@ -80,7 +86,12 @@
should 'raise if helper is not found' do
lambda{
Innate::HelpersHelper.try_require(:foo)
}.should.raise(LoadError).
message.should == "Helper foo not found"
+ end
+
+ should 'allow helper to be suffixed with "helper"' do
+ Innate::HelpersHelper.get(:foo_bar).baz.should == "baz"
+ Innate::HelpersHelper.get(:foo_bar_helper).baz.should == "baz"
end
end