From d36e62ed3dbc762cefbcf2bf6b36c22027a7b651 Mon Sep 17 00:00:00 2001 From: Kunpei Sakai Date: Thu, 5 Nov 2020 01:40:46 +0900 Subject: [PATCH] keep a test introduced in #1214 --- test/helpers_test.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/helpers_test.rb b/test/helpers_test.rb index 60489624..eb08d916 100644 --- a/test/helpers_test.rb +++ b/test/helpers_test.rb @@ -1947,5 +1947,31 @@ class HelpersTest < Minitest::Test assert ok? assert_equal '42 < 43', body end + + it 'prepends modules so previously-defined methods can be overridden consistently' do + skip <<-EOS + This test will be helpful after switching #helpers's code from Module#include to Module#prepend + See more details: https://github.com/sinatra/sinatra/pull/1214 + EOS + mock_app do + helpers do + def one; nil end + def two; nil end + end + + helpers ::HelperOne do + def two; '2' end + end + + get('/one') { one } + get('/two') { two } + end + + get '/one' + assert_equal '1', body + + get '/two' + assert_equal '2', body + end end end