Fix

Build Status Coverage Status Dependency Status Gem Version Inline docs Documentation

Specing framework for Ruby.

Contact

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

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Versioning

Fix follows Semantic Versioning 2.0

© 2014 Cyril Wack