
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
A tiny mocking framework focused on the Arrage-Act-Assert test pattern. Grasshopper is heavily modeled after Mockito.
For more examples, see the unit tests
Mock is a person who listens carefully but never says anything. You can say anything to Mock, but you'll only get crickets back.
mock = Grasshopper::Mock.new
mock.hello #=> nil
mock.how_are_you? #=> nil
Grasshopper::Mock.verify(mock).hello # yes, someone did tell me hello.
Grasshopper::Mock.verify(mock).goodbye # wait(AssertionFailed)! they left without saying goodbye!
Stub is a person who holds something for you and gives it to anyone who knows how to ask. You can ask Stub for anything, but you'll only get out what you put into it.
stub = Grasshopper::Stub.new
Grasshopper::Stub.when(stub.keys).then_return([:door_key, :mail_key])
Grasshopper::Stub.when(stub.money("gimmie")).then_return(5)
stub.keys #=> [:door_key, :mail_key]
stub.money("gimmie") #=> 5
stub.monkey #=> nil
or you can use this shorter style if you prefer:
Grasshopper::Stub.like(:keys => [:door_key, :mail_key], :money => 5)
stub.keys #=> [:door_key, :mail_key]
stub.money("gimmie") #=> 5
stub.monkey #=> nil
Grasshopper is named for a restaurant in Allston, MA that serves up all sorts of great mocks.
Copyright 2011-2021 Position Development, LLC.
Grasshopper is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Grasshopper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with Grasshopper. If not, see http://www.gnu.org/licenses/.
FAQs
Unknown package
We found that grasshopper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.