Fix
Specing framework for Ruby.
Contact
- Home page: http://fixrb.org/
- Bugs/issues: https://github.com/fixrb/fix/issues
- Support: https://stackoverflow.com/questions/tagged/fixrb
Rubies
Fix is supported by Ruby (MRI) 2+.
Installation
Add this line to your application's Gemfile:
gem 'fix'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fix
Philosophy
Minimalist
With ~400 lignes of simple code built on top of Spectus expectation library, facilities such as benchmarking and mocking are not supported. Fix offers however a consistent syntax to DRY and focus your BDD.
Resistant
While specs behave like documents which can be logic-less, their interpretation should not be questioned regardless of the version of Fix, preventing from software erosion. Also, Fix specs are complient with RFC 2119.
Complexity
Monkey-patching, magic tricks and friends are not included. Instead, animated by authentic and immutable Ruby objects, unambiguous, understandable and structured specs are encouraged.
Objective
After having loaded atomically the specs in read-only, the code to be tested can also be loaded and evaluated in isolation by Fix. There is a separation of concerns between the specs and the code.
Usage
class Duck
def walks
"Klop klop!"
end
def swims
"Swoosh..."
end
def quacks
puts "Quaaaaaack!"
end
end
@bird = Duck.new
require 'fix'
extend Fix::DSL
subject @bird
on :swims do
it { SHALL eql: "Swoosh..." }
it { MAY capture_stdout: " ...\n" }
end
on :quacks do
it { SHOULD capture_stdout: "Quaaaaaack!\n" }
end
on :speaks do
it { MUST raise_exception: NoMethodError }
end
on :sings do
it { MAY eql: "♪... ♫..." }
end
ruby duck_spec.rb
.....
Finished in 0.001033 seconds.
100% compliant (5 specs, 0 infos, 0 failures, 0 errors)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Versioning
Fix follows Semantic Versioning 2.0
Copyright
© 2014 Cyril Wack