Skip to content

Commit

Permalink
Way more legitimate feature definition
Browse files Browse the repository at this point in the history
Which drove the implementation of the ability to pass command line arguments. Win!
  • Loading branch information
travis committed Dec 2, 2009
1 parent 1f167d6 commit 832e64d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
9 changes: 9 additions & 0 deletions dummy-features/unimplented.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: Leave this feature unimplemented
So that I may drive the development of lein cuke
As a busy Behavior Driven Developer
I want to leave this as an unimplemented feature

Scenario: This feature should remain unimplemented
Given I have installed lein-cuke
When I leave this feature unimplemented
Then my tests should pass
9 changes: 9 additions & 0 deletions features/run-cucumber.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: Run cucumber
So that I may drive feature development using cucumber
As a busy Behavior Driven Developer
I want this plugin to run cucumber

Scenario: Our dummy features should be run by "lein cuke dummy-features"
Given I have installed lein-cuke
When I run "lein cuke dummy-features"
Then I should see "You can implement step definitions for undefined steps with these snippets" in the output
2 changes: 0 additions & 2 deletions features/show-cuke-in-help.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ Feature: Show cuke in help
Given I have installed lein-cuke
When I run "lein help"
Then I should see "cuke" in the output


16 changes: 10 additions & 6 deletions features/step_definitions/show_in_help.clj
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
(require 'leiningen.core
['clojure.contrib.str-utils2 :as 'str]
['clojure.contrib.shell-out :as 'shell])

(def help-output (atom ""))

(def output (atom ""))

(Before (reset! output ""))

(Given #"^I have installed lein-cuke"
#())

(When #"^I run \"lein help\""
#(reset! help-output
(shell/sh "lein" "help")))
(When #"^I run \"(.*)\""
#(reset! output
(apply shell/sh (.split %1 " "))))

(Then #"^I should see \"cuke\" in the output"
#(assert (not (= (.indexOf @help-output "cuke") -1))))
(Then #"^I should see \"(.*)\" in the output"
#(assert (str/contains? @output %1)))
7 changes: 4 additions & 3 deletions src/leiningen/cuke.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(ns leiningen.cuke)
(ns leiningen.cuke
(:use [clojure.contrib.str-utils2 :only (join)]))

(defn jruby
[options]
Expand All @@ -13,6 +14,6 @@

(defn cuke
"Run cucumber features"
[project]
(jruby "lib/gems/bin/cucumber")
[project & args]
(jruby (join " " (cons "lib/gems/bin/cucumber" args)))
)

0 comments on commit 832e64d

Please sign in to comment.