1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

add helpers test to confirm helpers are included.

This commit is contained in:
aldentea 2020-10-27 15:03:42 +09:00 committed by Kunpei Sakai
parent fe2b2f70ef
commit ce25d56ca9
No known key found for this signature in database
GPG key ID: C4B6919318C291BC

View file

@ -2000,5 +2000,26 @@ class HelpersTest < Minitest::Test
assert ok?
assert_equal 'InlineHelper#test', body
end
module HelperWithIncluded
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def nickname(name)
# do something.
end
end
end
class ServerApp < Sinatra::Base
helpers HelperWithIncluded
# `nickname` method should be available.
end
it 'calls included method of helpers' do
assert ServerApp.respond_to?(:nickname)
end
end
end