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 7a520bb commit 267daa5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 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)

=== 5.87.0 (2024-12-01)

* Add pg_schema_caching extension, for reloading OIDs for custom types when loading cached schema (jeremyevans)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ run_spec = proc do |file|
lib_dir = File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
rubylib = ENV['RUBYLIB']
ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)
sh "#{FileUtils::RUBY} #{"-w" if RUBY_VERSION >= '3'} #{file}"
sh "#{FileUtils::RUBY} #{"-w" if RUBY_VERSION >= '3'} #{'-W:strict_unused_block' if RUBY_VERSION >= '3.4'} #{file}"
ENV['RUBYLIB'] = rubylib
end

Expand Down
2 changes: 1 addition & 1 deletion lib/sequel/extensions/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def create_join_table(*args)
@actions << [:drop_join_table, *args]
end

def create_table(name, opts=OPTS)
def create_table(name, opts=OPTS, &_)
@actions << [:drop_table, name, opts]
end

Expand Down
4 changes: 2 additions & 2 deletions lib/sequel/extensions/null_dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def delete
end

# Return self without sending a database query, never yielding.
def each
def each(&_)
self
end

# Return nil without sending a database query, never yielding.
def fetch_rows(sql)
def fetch_rows(sql, &_)
nil
end

Expand Down
2 changes: 1 addition & 1 deletion spec/extensions/migration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def table_exists?(name)

it "should add a column name if it doesn't already exist in the schema_info table" do
@db.create_table(:schema_info){Integer :v}
def @db.alter_table(*); end
def @db.alter_table(*, &_); end
Sequel::Migrator.apply(@db, @dirname)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/model/hooks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -353,19 +353,19 @@ def around_validation
@c.raise_on_save_failure = false

o = @c.load(:id => 1)
def o.around_save() end
def o.around_save(&_) end
o.save.must_be_nil

o = @c.load(:id => 1)
def o.around_update() end
def o.around_update(&_) end
o.save.must_be_nil

o = @c.new
def o.around_create() end
def o.around_create(&_) end
o.save.must_be_nil

o = @c.new
def o.around_validation() end
def o.around_validation(&_) end
o.save.must_be_nil
end
end

0 comments on commit 267daa5

Please sign in to comment.