Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By meganemurav0.1.0MITIn 1 marketplace
Unofficial: teaches agents how to write property-based tests using Hegel in Ruby projects, driven by the third-party hegeltest gem
Claude loads one when your task matches it, or you run it by name.
Executables (bin/) — files in this plugin's bin/ directory are added to the Bash tool's PATH while the plugin is enabled.
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
[!IMPORTANT] This is an unofficial, third-party implementation. The Hegel project and the
libhegelengine belong to Antithesis, LLC. This repository has no affiliation with Antithesis or with thehegeldevorganization, and nobody there reviews or endorses it.The official implementations are Rust, Go, C++, TypeScript, Java, and OCaml. Report problems with this gem here, not to them.
[!NOTE] Hegel itself is in beta, and its maintainers expect to make breaking changes. See https://hegel.dev/compatibility.
Hegel is a property-based testing framework based on Hypothesis. Instead of writing tests with hand-picked inputs, you state a property that must hold for every input. Hegel generates inputs, tries to falsify the property, and shrinks any failure to a minimal counterexample.
This gem drives libhegel, the native
engine that the official implementations also drive. The engine runs in the
same process, through the ffi gem. There is no
server and no Python dependency.
The gem is published as hegeltest:
# Gemfile
gem "hegeltest", group: :test
The require path is hegel, and the namespace is Hegel.
require "hegeltest" also works, so Bundler's automatic require finds it.
The gem needs Ruby 3.4 or later. Each platform gem carries the matching
libhegel build, so an install compiles nothing and needs no engine on the
side:
| Platform | Gem platform |
|---|---|
| Linux x64 | x86_64-linux |
| Linux arm64 | aarch64-linux |
| macOS arm64 | arm64-darwin |
| Windows x64 | x64-mingw-ucrt |
| Windows arm64 | aarch64-mingw-ucrt |
The Hegel maintainers permit a third-party project to redistribute their release binaries (hegeldev/hegel-rust#411).
A project that already has a Gemfile.lock needs one more step. Bundler adds
only the platform of the machine that runs bundle install, so a lock made on
a Mac does not name Linux. A Linux CI job then cannot find the gem. Add each
platform your CI uses:
bundle lock --add-platform x86_64-linux
On a platform with no published libhegel build, such as macOS on Intel, build
the engine yourself and set HEGEL_LIBHEGEL_PATH to the library file or to the
directory that holds it. The same variable makes any platform use a local
engine build in place of the bundled one.
Each gem release pins one libhegel release. To see the pinned version in your installed gem:
ruby -rhegel -e 'puts Hegel::LIBHEGEL_VERSION'
The CHANGELOG section of each gem release starts with the engine move, when there is one, and links the release notes of that engine version. The GitHub releases show the same text.
When libhegel publishes a new release, a pull request moves this gem to it. The gem version and the engine version are independent: a gem release can change the engine, the Ruby code, or both.
# spec/spec_helper.rb
require "hegel"
RSpec.configure do |config|
config.include Hegel::Syntax::Methods
end
# spec/my_sort_spec.rb
def my_sort(ls) = ls.sort.uniq # oops: uniq drops duplicates
RSpec.describe "my_sort" do
it "matches the builtin sort" do
Hegel.test do |tc|
xs = tc.draw(arrays(integers))
expect(my_sort(xs)).to eq(xs.sort)
end
end
end
That test fails, and Hegel shrinks the failure to the smallest input that still shows the bug. The report looks like this:
Falsified after 11 test cases (0 discarded):
xs = [0, 0]
To reproduce this failure, pass the blob below to Hegel.test:
reproduce_failure: "AXicY2VgYGBkZOBiZEBhMAAAAd8AIQ=="
The count of test cases and the blob change from run to run, and between
engine releases. The shrunk value is the part to read: two duplicates are all
it takes. Hegel names the value xs by reading the line the draw was written
on. Then it re-raises RSpec's own expectation failure, so RSpec reports it as
its own.
Including Hegel::Syntax::Methods makes the generators available without a
prefix, the way FactoryBot makes create available. The same generators are
also available as Hegel::Generators.arrays(...) without the include.
To keep the generator names out of example groups that have their own helpers, include the methods only in tagged groups:
config.include Hegel::Syntax::Methods, :hegel
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub meganemura/hegel-ruby --plugin hegel-rubyPlugins from other owners that cover similar ground