Skip to content

Commit

Permalink
Fix strict_unused_block warnings when running specs on Ruby 3.4
Browse files Browse the repository at this point in the history
Run the specs with -W:strict_unused_block on Ruby 3.4 to more
easily catch future issues.
  • Loading branch information
jeremyevans committed Dec 18, 2024
1 parent 8f7a89b commit 7ddfb97
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=== master

* Fix strict_unused_block warnings when running specs on Ruby 3.4 (jeremyevans)

= 3.87.0 (2024-12-17)

* Add host_routing plugin for routing based on request host header (jeremyevans)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end

spec = proc do |env|
env.each{|k,v| ENV[k] = v}
sh "#{FileUtils::RUBY} #{"-w" if RUBY_VERSION >= '3'} spec/all.rb"
sh "#{FileUtils::RUBY} #{"-w" if RUBY_VERSION >= '3'} #{'-W:strict_unused_block' if RUBY_VERSION >= '3.4'} spec/all.rb"
env.each{|k,v| ENV.delete(k)}
if File.directory?('.sass-cache')
require 'fileutils'
Expand Down
2 changes: 1 addition & 1 deletion lib/roda/plugins/head.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def initialize(body)
end

# yield nothing
def each
def each(&_)
end

# this should be called by the Rack server
Expand Down
2 changes: 1 addition & 1 deletion spec/plugin/not_found_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
end

o = Object.new
def o.each; end
def o.each(&_); end
route do |r|
r.halt [404, {}, o]
end
Expand Down
2 changes: 1 addition & 1 deletion spec/plugin/status_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
end

o = Object.new
def o.each; end
def o.each(&_); end
route do |r|
r.halt [404, {}, o]
end
Expand Down

0 comments on commit 7ddfb97

Please sign in to comment.