Skip to content

Commit

Permalink
Use Object#stub instead of rr (#409)
Browse files Browse the repository at this point in the history
Since the [last commit for rr is in 2022](https://github.com/rr/rr/commits/master/), and currently, only the `stub` feature of rr is being used in committee, I believe it is possible to replace this with [Object#stub](https://www.rubydoc.info/gems/minitest/5.3.0/Object:stub) provided by Minitest. In general, I think it's better to minimize dependencies.
  • Loading branch information
ydah authored Jan 24, 2024
1 parent 2756c76 commit f0611dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion committee.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "minitest", "~> 5.3"
s.add_development_dependency "rack-test", "~> 0.8"
s.add_development_dependency "rake", "~> 13.1"
s.add_development_dependency "rr", "~> 1.1"
s.add_development_dependency "pry"
s.add_development_dependency "pry-byebug"
s.add_development_dependency "rubocop"
Expand Down
14 changes: 8 additions & 6 deletions test/committee_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
old_stderr = $stderr
$stderr = StringIO.new
begin
stub(Committee).debug? { false }
Committee.log_debug "blah"
assert_equal "", $stderr.string
Committee.stub(:debug?, false) do
Committee.log_debug "blah"
assert_equal "", $stderr.string
end

stub(Committee).debug? { true }
Committee.log_debug "blah"
assert_equal "blah\n", $stderr.string
Committee.stub(:debug?, true) do
Committee.log_debug "blah"
assert_equal "blah\n", $stderr.string
end
ensure
$stderr = old_stderr
end
Expand Down
1 change: 0 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
require "minitest/spec"
require "minitest/autorun"
require "rack/test"
require "rr"
require "pry"
require "stringio"

Expand Down

0 comments on commit f0611dc

Please sign in to comment.