Skip to content

Commit

Permalink
Fixed bug where -getSnippet in clj.clj received only the step parameter.
Browse files Browse the repository at this point in the history
cucumber.runtime.UndefinedStepsTracker actually calls the Backend
instances with 2 parameters--Step and FunctionNameGenerator--but
Clojure's Backend implementation only accepts one.

Instead of testing generation of Clojure Snippet with a test-only
ClojureSnippet instance, ClojureSnippetTest now tests the real
implementation in clj.clj.
  • Loading branch information
shaolang committed Dec 19, 2013
1 parent 77a93d1 commit 5e3d2fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 50 deletions.
4 changes: 2 additions & 2 deletions clojure/src/main/clj/cucumber/runtime/clj.clj
Expand Up @@ -57,8 +57,8 @@

(defn- -disposeWorld [cljb])

(defn- -getSnippet [cljb step]
(.getSnippet snippet-generator step))
(defn- -getSnippet [cljb step _]
(.getSnippet snippet-generator step nil))

(defn- -setUnreportedStepExecutor [cljb executor]
"executor")
Expand Down
45 changes: 0 additions & 45 deletions clojure/src/test/java/cucumber/runtime/clojure/ClojureSnippet.java

This file was deleted.

@@ -1,6 +1,6 @@
package cucumber.runtime.clojure;

import cucumber.runtime.snippets.SnippetGenerator;
import cucumber.runtime.clj.Backend;
import gherkin.formatter.model.Comment;
import gherkin.formatter.model.DataTableRow;
import gherkin.formatter.model.Step;
Expand All @@ -18,7 +18,7 @@ public class ClojureSnippetTest {
@Test
public void generatesPlainSnippet() {
Step step = new Step(NO_COMMENTS, "Given ", "I have 4 cukes in my \"big\" belly", 0, null, null);
String snippet = new SnippetGenerator(new ClojureSnippet()).getSnippet(step, null);
String snippet = (new Backend(null)).getSnippet(step, null);
String expected = "" +
"(Given #\"^I have (\\d+) cukes in my \\\"([^\\\"]*)\\\" belly$\" [arg1 arg2]\n" +
" (comment Write code here that turns the phrase above into concrete actions )\n" +
Expand All @@ -30,7 +30,7 @@ public void generatesPlainSnippet() {
public void generatesSnippetWithDataTable() {
List<DataTableRow> dataTable = asList(new DataTableRow(NO_COMMENTS, asList("col1"), 1));
Step step = new Step(NO_COMMENTS, "Given ", "I have:", 0, dataTable, null);
String snippet = new SnippetGenerator(new ClojureSnippet()).getSnippet(step, null);
String snippet = (new Backend(null)).getSnippet(step, null);
String expected = "" +
"(Given #\"^I have:$\" [arg1]\n" +
" (comment Write code here that turns the phrase above into concrete actions )\n" +
Expand Down

0 comments on commit 5e3d2fd

Please sign in to comment.