Skip to content

Commit

Permalink
Add tests for extended steps (tables, multi-line).
Browse files Browse the repository at this point in the history
Miraculously, this has worked, right out of the box. It will be very useful once we start supporting table diffs.
  • Loading branch information
antifuchs committed Jul 12, 2010
1 parent 2266792 commit e94b73d
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions features/extended-steps.feature
@@ -0,0 +1,103 @@
Feature: Extended steps

As a user of Clucumber, I want to define multi-line steps
So that I can test large amounts of text or tables.

Scenario: Multi-line strings

Given a standard Cucumber project directory structure
Given the standard clucumber setup
Given a file named "features/multiline.feature" with:
"""
Feature: Multiline step args
Scenario: A multiline string
Given I have a step that takes one arg:
\"\"\"
foo
bar baz
\"\"\"
"""
Given a file named "features/step_definitions/multi-line-steps.lisp" with:
"""
(Given* #?{^I have a step that takes one arg:$} (string)
(assert (string= string "foo
bar baz")))
"""


When I run "cucumber -f progress"
Then it should pass with exactly:
"""
.
1 scenario (1 passed)
1 step (1 passed)
"""

Scenario: Simple Tables

Given a standard Cucumber project directory structure
Given the standard clucumber setup
Given a file named "features/multiline.feature" with:
"""
Feature: Table step args
Scenario: A simple table step
Given I have a step that wants these args:
| foo |
| bar |
| baz |
"""
Given a file named "features/step_definitions/table-steps.lisp" with:
"""
(Given* #?{^I have a step that wants these args:$} (table)
(assert (equal '(("foo") ("bar") ("baz")) table)))
"""


When I run "cucumber -f progress"
Then it should pass with exactly:
"""
.
1 scenario (1 passed)
1 step (1 passed)
"""

Scenario: Tables with an additional argument

Given a standard Cucumber project directory structure
Given the standard clucumber setup
Given a file named "features/multiline.feature" with:
"""
Feature: Table step args
Scenario: A table step that matches additional args
Given I have step 1 that wants these args:
| foo |
| bar |
And I have step 2 that wants these args:
| wibbly |
| wobbly |
"""
Given a file named "features/step_definitions/table-steps.lisp" with:
"""
(Given* #?{^I have step (\d+) that wants these args:$} (number table)
(case (parse-integer number)
(1 (assert (equal '(("foo") ("bar")) table)))
(2 (assert (equal '(("wibbly") ("wobbly")) table)))))
"""


When I run "cucumber -f progress"
Then it should pass with exactly:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""

0 comments on commit e94b73d

Please sign in to comment.