Skip to content

Commit

Permalink
Disable VERBOSE warnings in test stubs (whitesmith#466)
Browse files Browse the repository at this point in the history
To prevent warning during tests while we deliberately override certain methods.

Warnings include:
rubycritic/test/fakefs_helper.rb:8: warning: method redefined; discarding old flock
rubycritic/.bundle/ruby/3.2.0/gems/fakefs-2.4.0/lib/fakefs/file.rb:586: warning: previous definition of flock was here
rubycritic/test/lib/rubycritic/commands/compare_test.rb:12: warning: method redefined; discarding old current_branch
rubycritic/lib/rubycritic/source_control_systems/git.rb:82: warning: previous definition of current_branch was here

See: whitesmith#465
  • Loading branch information
fbuys authored Oct 5, 2023
1 parent 8eaaaf7 commit 1d20e4f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* [CHANGE] Fix test warning related to `cucumber_opts` declaration (by [@faisal][])
* [BUGFIX] Stop using long-deprecated MiniTest module name, removed in 5.19.0 (by [@faisal][])
* [CHANGE] Disable VERBOSE warnings in test stubs (by [@fbuys][])

# v4.8.1 / 2023-05-17 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.8.0...v4.8.1)

Expand Down
4 changes: 4 additions & 0 deletions test/fakefs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@

module FakeFS
class File < StringIO
# $VERBOSE = nil to suppress warnings when we overrie flock.
original_verbose = $VERBOSE
$VERBOSE = nil
def flock(*)
true
end
$VERBOSE = original_verbose
end
end

Expand Down
4 changes: 4 additions & 0 deletions test/lib/rubycritic/commands/compare_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
module RubyCritic
module SourceControlSystem
class Git < Base
# $VERBOSE = nil to suppress warnings when we overrie self.current_branch.
original_verbose = $VERBOSE
$VERBOSE = nil
def self.current_branch
'feature_branch'
end
$VERBOSE = original_verbose
end
end

Expand Down

0 comments on commit 1d20e4f

Please sign in to comment.