• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Ruby
  • License
    Other
  • Created about 15 years ago
  • Updated over 13 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Given-when-then for Test::Unit (or "If shoulda and cucumber had a baby")

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

More Repositories

1

acts_as_commentable_with_threading

Similar to acts_as_commentable; however, utilizes awesome_nested_set to provide threaded comments
Ruby
672
star
2

yourdsl

~1/2 of a compiler for an internal DSL: a lexer and partial parser for contextual internal DSLs
Ruby
22
star
3

modest_presenter

A simple Presenter for use with arbitrary templating languages
Ruby
12
star
4

rb-skypemac

Ruby API to Skype via Skype's AppleScript API
Ruby
11
star
5

jrsplenda

Sweetens up JRuby Mocha with several helpers to simplify testing Java from Ruby
Ruby
7
star
6

slack_emoticon_inhaler

Chrome extension that automatically downloads every emoticon on a Slack's customize/emoji page
JavaScript
6
star
7

coulda_web_steps

capybara and factory_girl-based web steps for coulda
Ruby
5
star
8

.emacs.d

My humble little emacs config
Emacs Lisp
5
star
9

pairing-server

My Vagrant Rackspace Ruby EMACS pairing env
Ruby
3
star
10

twitterbot--public-dms

Echoes received DMs to it's public timeline
Ruby
3
star
11

twitter--follow-my-followers

Follows twitter users who follow the auth'd user
Ruby
3
star
12

ruby-quiz-74

Markov Chaining while teaching teh TDDz to joblesspirate
Ruby
2
star
13

conway-erlang

Erlang
2
star
14

autodroid

A partly working car-dock-based app to provide a highly usable UI for tasks when driving. Currently provides a custom user interface for playing Music.
Java
2
star
15

ruby-conway

A Ruby Conway's Game of Life implementation with a Ruby Proessing visualizer
Ruby
2
star
16

pickleberry_pie

Rails 3 app for Pickleberry Pie, a 501(c)3
Ruby
2
star
17

rbwikipedia-film

Provides a simple API for finding an extracting basic metadata about films (including movie posters) from wikipedia
Ruby
2
star
18

Conway-s-Game-of-Life-in-Javascript

Obsessively hacking away at Conway's Game of Life but now in JS
JavaScript
2
star
19

vim_runtime

Vim Script
1
star
20

remote_jobs

JavaScript
1
star
21

everything

Yes, everything
Ruby
1
star
22

vim

Vim Script
1
star
23

dot.emacs

Emacs Lisp
1
star
24

describe

Hub project for distilling nested specs down to just the specs, ma'am.
Ruby
1
star
25

rubywarrior_marshall

Killing my warrior, Marshall, again and again as he attempts to traverse the evil dungeon of @rbates' rubywarrior
Ruby
1
star
26

mongomapper-rails3-branch-example

Skeleton app using the latest from mongo_mapper rails3 branch
Ruby
1
star
27

gem-skeleton-minitest

Ruby
1
star
28

fog-rackspace

WIP extraction of Rackspace provider from fog gem into a separate gem living under fog
Ruby
1
star