Merb

myabc edited this page Aug 13, 2010 · 29 revisions

Install

Cucumber can be used with Merb via the merb_cucumber plugin.

To install merb_cucumber:

sudo gem install david-merb_cucumber

Or you can install jsmestad-merb_cucumber

sudo gem install jsmestad-merb_cucumber

Here is a brief note from jsmestad.

Note – you must uninstall david-merb_cucumber in order for this gem to take precedence. Merb + Cucumber + Webrat testing stack. Builds upon David’s work, but binds Webrat as a dependency to hopefully ensure a smooth upgrade for future Webrat releases. Also Factory_Girl generators will be added soon.

Here’s a better one

sudo gem install roman-merb_cucumber

Note – both justin’s and david’s merb_cucumber forks didnt work for me (they don’t seem to use the bundled directory). Try Roman’s

Usage

The inside of a merb application directory, try:

merb-gen cucumber
merb-gen feature FEATURE_NAME

Edit your feature, and:

rake features

Tips

Describe can use multiple given blocks

For example, you can now
(since Feb 26, 2009 commit by carllerche) write


given "some food" do
  @food = "pizza"
end

given "some drink" do
  @drink = "beer"
end

describe "Something", :given => ["some food", "some drink"] do
  it "should have dinner" do
    # has @food and @drink set to pizza and beer, respectively
  end
end

Looking for Examples?

So am I. Therefore I’ve been scrounging github in search of some. There are many merb projects out there with empty /features sitting around so searching github can potentially return many false positives.

But, please add some when you find them!

Here are some merb projects that use cucumber (feel free to add/update/delete this list accordingly, I did not rigorously weed through each one but I did only include /features that had actual substantial or interesting/creative examples):

Tutorials