Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New clojure example #309

Merged
merged 4 commits into from
Apr 29, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/clojure_cukes/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# clojure-cukes

Just a little example illustrating how to use Cucumber with Clojure and Leiningen.
If someone with more Clojure knowledge can improve this it would be great.
Just a little example illustrating how to use Cucumber with Clojure and Leiningen. Please note that the example uses https://github.com/nilswloka/lein-cucumber, which requires Leiningen 2.

## Running cukes

lein test
lein2 deps
lein2 cucumber
7 changes: 4 additions & 3 deletions examples/clojure_cukes/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(defproject clojure_cukes "1.0.0.RC2-SNAPSHOT"
(defproject clojure_cukes "1.0.5-SNAPSHOT"
:description "A demo of Cucumber with Clojure and Leiningen"
:dependencies [[org.clojure/clojure "1.4.0-alpha3"]
[info.cukes/cucumber-clojure "1.0.0.RC2-SNAPSHOT"]])
:dependencies [[org.clojure/clojure "1.4.0-alpha3"]]
:plugins [[lein-cucumber "1.0.0"]]
:cucumber-feature-paths ["test/features/"])
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
(use 'clojure-cukes.core)
(use 'clojure.test)

(Given #"^I have (\d+) big \"([^\"]*)\" in my belly$"
(fn [n, thing]
(reset! belly (repeat (read-string n) thing))))
(Given #"^I have (\d+) big \"([^\"]*)\" in my belly$" [n, thing]
(reset! belly (repeat (read-string n) thing)))

(When #"I eat (\d+) \"([^\"]*)\""
(fn [n, thing]
(eat (repeat (read-string n) thing))))
(When #"I eat (\d+) \"([^\"]*)\"" [n, thing]
(eat (repeat (read-string n) thing)))

(Then #"^I am \"([^\"]*)\"$"
(fn [mood-name]
(assert (= (name (mood)) mood-name))))
(Then #"^I am \"([^\"]*)\"$" [mood-name]
(assert (= (name (mood)) mood-name)))