Skip to content

Commit

Permalink
Merge pull request #175 from rferraz/clojure_hook_fix
Browse files Browse the repository at this point in the history
Fixed hooks in Clojure
  • Loading branch information
aslakhellesoy committed Jan 26, 2012
2 parents 32474d9 + 295a901 commit 350018a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.List;

import static java.util.Arrays.asList;

Expand All @@ -24,7 +25,9 @@ public ClojureHookDefinition(String[] tagExpressions, IFn closure) {

// Clojure's AFunction.invokeWithArgs doesn't take varargs :-/
private Method lookupInvokeMethod(Object[] args) throws NoSuchMethodException {
return IFn.class.getMethod("invoke", (Class<?>[]) Utils.listOf(args.length, String.class).toArray());
List<Class<Object>> classes = Utils.listOf(args.length, Object.class);
Class<?>[] params = classes.toArray(new Class<?>[classes.size()]);
return IFn.class.getMethod("invoke", params);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
(use 'cucumber.runtime.clojure.belly)

(Before)
(After)

(Given #"^I have (\d+) cukes in my belly$"
#(eat (Float. %1)))

Expand Down

0 comments on commit 350018a

Please sign in to comment.