The Three Levels of Requirements Inspired by RFC 2119
Discover how Fix implements MUST, SHOULD, and MAY requirement levels for more precise specifications, and how this approach compares to RSpec’s historical evolution.
A collection of Ruby testing libraries designed to make programmers happy.
Fix is at the heart of it. A specification describes how an object must behave, apart from any implementation. A test then challenges one implementation against it, and the same specification can challenge as many implementations as you need.
require "fix"
# A specification
Fix :Calculator do
on(:new, 2) do
on(:add, 3) do
it MUST be 5
end
end
end
# An implementation
class Calculator
def initialize(first)
@first = first
end
def add(second)
@first + second
end
end
# A test
Fix[:Calculator].test { Calculator }
Each gem does one thing, in a few hundred lines of code at most, so that you can read it before you trust it.
Fix is the main gem of Fixrb. fix-command and fix-its extend it.
Specifications with MUST, SHOULD and MAY requirements, kept apart from the implementations they challenge.
1.0 in preparation
The fix command, to run specification files.
Moving to Fix 1.0
Adds its to specifications, to describe an attribute in one line.
Moving to Fix 1.0
These gems do not extend Fix: use them on their own, with any test framework, or to build one. Fix 1.0 is built on matchi and aw.
Matchers for any test framework, in which the expected value makes the comparison, not the object under test.
Version 5.0
Extends matchi with a matcher that checks a value against a Fix specification, from any test framework.
Moving to Fix 1.0
Runs a block in a forked process and returns its result. Fix uses it to keep contexts apart.
1.0 in preparation
Expectations with the requirement levels of RFC 2119. Built on test_tube and expresenter.
Version 5.0
Checks a value, or what a block returns or raises, against a matcher. Built on defi.
Version 4.0
Presents the result of an expectation: success, warning, info, failure or error.
Version 1.5
Prepares a method call, a name and its arguments, to send to any object.
Version 3.0
Writes plain Ruby tests from a YAML file, by recording what your code returns in every combination of contexts.
1.6 in beta
Discover how Fix implements MUST, SHOULD, and MAY requirement levels for more precise specifications, and how this approach compares to RSpec’s historical evolution.
Discover how Fix’s unique approach to testing in Ruby promotes clear separation between specifications and implementation, making your test suite more maintainable and reusable.
Explore why the distinction between expected and actual values is crucial in test design, and how it impacts the robustness and reliability of your test suite.