Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tests for extended steps (tables, multi-line).

Miraculously, this has worked, right out of the box. It will be very useful once we start supporting table diffs.
  • Loading branch information...
commit e94b73dba3fd495d4dee46129c9615b1bf4c0ec7 1 parent 2266792
@antifuchs antifuchs authored
Showing with 103 additions and 0 deletions.
  1. +103 −0 features/extended-steps.feature
View
103 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)
+
+ """
Please sign in to comment.
Something went wrong with that request. Please try again.