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
1 changed files with 21 additions and 0 deletions

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