Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Use prepend instead of include for helpers. Fixes #1213" #1662

Merged
merged 5 commits into from
Nov 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
keep a test introduced in #1214
  • Loading branch information
namusyaka committed Nov 4, 2020
commit d36e62ed3dbc762cefbcf2bf6b36c22027a7b651
26 changes: 26 additions & 0 deletions test/helpers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1947,5 +1947,31 @@ def foo
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