Giter Club home page Giter Club logo

coulda's Introduction

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

Coulda.default_testcase_class = ActiveSupport::TestCase

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

  def given_something
  end

  Scenario "pending scenario"

  Scenario "another scenario" do
    Given "a pending prereq"
    When "something happens" do
      # an event here
    end
    Then "expect something else" do
      # assert something here
    end
  end

  Scenario "that is live" do
    given_something
    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 through 0.5.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.