sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
Object#stub
Add a temporary stubbed method replacing +name+ for the duration
of the +block+. If +val_or_callable+ responds to #call, then it
returns the result of calling it, otherwise returns the value
as-is. If stubbed method yields a block, +block_args+ will be
passed along. Cleans up the stub at the end of the +block+. The
method +name+ must exist before stubbing.
def test_stale_eh
obj_under_test = Something.new
refute obj_under_test.stale?
Time.stub :now, Time.at(0) do
assert obj_under_test.stale?
end
endEdit
git clone [email protected]:sonic-pi-net/sonic-pi.git
cd sonic-pi
open app/server/ruby/vendor/minitest-5.18.1/lib/minitest/mock.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Object-stub-for-pr
# Commit to gitgit add app/server/ruby/vendor/minitest-5.18.1/lib/minitest/mock.rbgit commit -m "better docs for Object#stub"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Object-stub-for-pr
hub pull-request
# Celebrate!