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

Fix use with keyword arguments for Ruby 3.0 #1701

Merged
merged 1 commit into from Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/sinatra/base.rb
Expand Up @@ -1471,6 +1471,7 @@ def use(middleware, *args, &block)
@prototype = nil
@middleware << [middleware, args, block]
end
ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true)

# Stop the self-hosted server if running.
def quit!
Expand Down
10 changes: 10 additions & 0 deletions test/middleware_test.rb
Expand Up @@ -97,4 +97,14 @@ def call(env)
get '/'
end

class KeywordArgumentIntializationMiddleware < MockMiddleware
def initialize(app, **)
super app
end
end

it "handles keyword arguments" do
@app.use KeywordArgumentIntializationMiddleware, argument: "argument"
get '/'
end
end