I'm not trying to pick on #mockists, but as I point out in this #StackOverflow comment, mocks, #testdoubles, and stubbed methods don't always add value. In addition, this approach requires the rspec-mocks gem in addition to #RSpec core and expectations to create an RSpec::Mocks::Double, plus `allow(dbl).to receive` just to `expect(dbl).to receive`.

This is a layer of overhead and test indirection that is often unnecessary IMHO. YMMV, but it's often worth rethinking.

https://stackoverflow.com/questions/78265716/how-to-test-a-script-that-pushes-gems#comment138009811_78265716

How to test a script that pushes gems?

I have this script: #!/usr/bin/env ruby # frozen_string_literal: true if ARGV.any? puts "USAGE: release" exit end def system!(command) puts command system(command, exception: tr...

Stack Overflow

Test #mockists don't like it when you point out that they're suffering from self-inflicted X/Y problems. They think mocking objects tests something useful, but it almost never does. The only reason to use mocks and stubs is to *isolate* the object under test from irrelevant or expensive calls to collaborators or outside systems, or to return a predefined result. You can never convince such people that it's a fallacious solution to a non-problem, though.

https://stackoverflow.com/q/78265716/1301972

How to test a script that pushes gems?

I have this script: #!/usr/bin/env ruby # frozen_string_literal: true if ARGV.any? puts "USAGE: release" exit end def system!(command) puts command system(command, exception: tr...

Stack Overflow