-
Notifications
You must be signed in to change notification settings - Fork 3
polyglot update #16
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
base: master
Are you sure you want to change the base?
polyglot update #16
Conversation
49dc042 to
71529d6
Compare
sdwolfz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see nothing wrong with the ruby style used here. It seems to support namespacing inside modules, which normal cucumber does not seem to have so I would mark that as a plus.
Should be ready to
whenever you feel ready.
| Step definitions can be defined by requiring 'jukebox' and using `step`: | ||
|
|
||
| ```ruby | ||
| require jukebox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require 'jukebox'
Jukebox - Polyglot Update
This update makes jukebox work with steps defined in multiple languages. Each step can be defined in a supported language (currently clojure or ruby). When a scenario is run, each step will be run in whichever language it's defined with.
Syntax
Here are some example step definition snippets:
How it works (architecture)
deps.ednorproject.cljfile in the current directory. Ruby is detected with the presense of aGemfile. This can also be defined explicitly in a.jukeboxfile (see below).jukebox language clientis launched for each language. In the default configuration, the clojure client is launched in memory. The ruby client is launched by runningbundle exec jcl_ruby. This can explicitly configured in a.jukeboxfile.Configuration
A jukebox configuration can be defined explicitly if needed in a project by creating a
.jukeboxfile with the following (JSON):{"languages": ["ruby", "clojure"]}In addition, the launcher details can be configured if needed by adding the "language-clients" configuration. These are the defaults:
{"languages": ["ruby", "clojure"], "language-clients": [{"language": "clojure", "launcher": "jlc-clj-embedded"}, {"language": "ruby", "launcher": "jlc-cli", "cmd": ["bundle", "exec", "jlc_ruby"]}]}Ruby Details
Defining Step Definitions & Hooks
Step definitions can be defined by requiring 'jukebox' and using
step:Cucumber Compatibility
If a step is defined in a cucumber style (
When,Then, etc), then the Ruby jukebox language client will switch to Cucumber compatibility mode. This mode replicates / requires the code to be laid out in the cucumber conventions. In compatibility mode, theboardis not provided to the step definition, unless the arity supports it.Clojure Details
Defining steps with metadata tags
Functions can be tagged as step definitions using function meta:
Functions can be tagged as hooks with the metadata keys:
:step/before,:step/after,:step/before-step, or:step/after-step:Defining steps with the
stepmacroSteps can now alternatively be defined with the
stepmacro that works like the Ruby version: