Railsconf: Cucumber – Aslak Hellesoy

May 6, 2009 Pivotal Labs

Most of this talk was a basic Cucumber primer. However these things were new to me:

Multi-line arguments

You can use this in a spec; it adds a block argument with the string in it:

"""
  multi-line
  string
"""

Tables

This Genearates a block argument as an array of hashes. ActiveRecord.create can take this as an argument.

Given the following proposals
  |email                    | title   |
  |aslak.hellesoy@gmail.com | Cucumber|
  |bryan@brynary.com        | Webrat  |

Abstract Scenarios

Scenario Outline: Email accepted prposals
  Given the following proposals
    |email                    | title   |
    |aslak.hellesoy@gmail.com | Cucumber|
    |bryan@brynary.com        | Webrat  |
  And the <proposal> proposal is approved
  When I send proposal emails
  Then <email> should <what>

  Examples:
    | proposal | email                    | what          |
    | Cucumber | aslak.hellesoy@gmail.com | get email     |
    | Cucumber | bryan@brynary.com        | not get email |
    | Webrat   | bryan@brynary.com        | get email     |

Before/After/World

Before do
end

After do |scenario|
end

World do
end

World(MyModule)

Background

Feature: Notification emails
  Background:

Tagged Features

Feature: Take over the world
  I want it all

  @spanish @french @english
  Scenario: Take over Europe

Then run:

cucumber -t french doit.feature

# or negative

cucumber -t ~french doit.feature

About the Author

Biography

Previous
Follow-ups from my RailsConf talk
Follow-ups from my RailsConf talk

First, thanks to everyone who came - especially those who laughed at all the right spots. If I didn't get ...

Next
Railsconf: Smacking Git Around – Advanced Git Tricks Scott Chacon (GitHub)
Railsconf: Smacking Git Around – Advanced Git Tricks Scott Chacon (GitHub)

Presentation Cheat Sheet Range selection: Full SHA1 Partial SHA1 - at least 4 characters and unique Bran...