public
Description: Given-when-then for Test::Unit (or "If shoulda and cucumber had a baby")
Homepage:
Clone URL: git://github.com/elight/coulda.git
coulda /
name age message
directory .devver/ Wed Sep 23 14:40:26 -0700 2009 Adding a file to convince Devver to attempt to ... [elight]
file .gitignore Fri Oct 09 16:17:24 -0700 2009 Why didn't that last change work? [elight]
file .rvmrc Wed Dec 02 11:25:31 -0800 2009 Added for my personal sanity [elight]
file HISTORY Tue Dec 08 08:15:17 -0800 2009 Updated coulda:print_features to generate more ... [elight]
file LICENSE Fri Sep 11 22:01:15 -0700 2009 Updated sample; sample executes correctly; stil... [elight]
file README.rdoc Fri Dec 04 09:06:33 -0800 2009 Updated thanks in README [elight]
file Rakefile Fri Dec 04 09:26:25 -0800 2009 Woops! Needed to test the rake task. Fixed [elight]
file VERSION Tue Dec 08 08:15:17 -0800 2009 Updated coulda:print_features to generate more ... [elight]
file coulda.gemspec Tue Dec 08 08:15:17 -0800 2009 Updated coulda:print_features to generate more ... [elight]
directory example/ Mon Nov 23 13:22:57 -0800 2009 Updated example for 0.4 compliance [elight]
file geminstaller.yml Mon Sep 14 20:49:46 -0700 2009 updated [Dan Mayer]
directory lib/ Tue Dec 08 08:15:17 -0800 2009 Updated coulda:print_features to generate more ... [elight]
directory test/ Fri Dec 04 14:33:53 -0800 2009 Adds call-by-name via a symbol per http://githu... [elight]
README.rdoc

Coulda


Coulda gives you Cucumber-like BDD power but with an internal DSL. This means no "call-by-regexp" and no Gherkin/plain-text/external DSL. Coulda is just code — but with a Cucumber-like take on BDD.

Coulda, obviously was inspired by Cucumber, Shoulda, but also Thor. Coulda believes that the best way to reuse code is the good ol’ fashioned method. Instead of sharing files of regexps mapped to procs, you just write methods. That simple.

You can define the implementation of your Given/When/Then right there with the behavior description. Or, if you want to reuse some Givens/Whens/Thens, just write a method! And if you find your Feature is getting too bloated or that you would like to reuse Givens/Whens/Thens between features, put them in a helper.

Coulda also easily supports your Test::Unit framework of choice (including Rails Tests).

See coulda.tiggerpalace.com for more information.

Easy as pie.

  require 'rubygems'
  require 'coulda'
  include Coulda

  Feature "feature name" do
    in_order_to "foo"
    as_a "bar"
    i_want_to "blech"

    def something
    end

    def expectation
    end

    Scenario "pending scenario"

    Scenario "another scenario" do
      Given "a pending prereq"
      When "something happens" do
        something
      end
      Then "expect something else" do
        expectation
      end
    end

    Scenario "that is live" do
      Given "foo" do; end
      When "bar" do; end
      Then "blech" do; end
    end
  end

Thanks to


  • David Chelimsky and Jim Weirich for turning me into the test-obsessed developer that I am.
  • Timothy King for putting up with my scotch-powered rambling while working on v0.4.0
  • We Are Titans (www.wearetitans.net/) for sponsoring v0.4.0 on up