Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Snippets #12

Open
mattwynne opened this issue Feb 13, 2015 · 4 comments
Open

Snippets #12

mattwynne opened this issue Feb 13, 2015 · 4 comments

Comments

@mattwynne
Copy link
Contributor

Luxury feature this, but we should aim for it.

When a step is undefined, Cucumber should delegate to Cucumber-Tcl to get snippet suggestions for Tcl, then print them to the console.

@ahhbristow
Copy link
Contributor

I've got the outline of a custom TCL formatter for this on a branch, which extends the default pretty one, but not sure if this is the correct approach. From looking through Cucumber I can see that it adds support for the "Ruby Language", with the RbLanguage class registering a Ruby snippet generator, so perhaps adding TCL support in a similar way is a better approach, rather than using an entirely different formatter.

@mattwynne
Copy link
Contributor Author

mattwynne commented Feb 1, 2017

Yeah @ahhbristow formatters are really for results output, and they delegate to the snippet generators to print the snippets. If you write a snippet generator (it's really just one Ruby proc, or an object that responds to call) then that will allow you to use any of the formatters and still get snippets.

@mattwynne
Copy link
Contributor Author

So yeah, if you do something like https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/rb_support/rb_language.rb#L56 around about here you'll be on the right track.

@mattwynne
Copy link
Contributor Author

The existing snippets look more complex than they really are because there's some sophistication around exactly what style of Ruby snippet is generated.

The tests are probably quite instructive though: https://github.com/cucumber/cucumber-ruby/blob/master/spec/cucumber/rb_support/snippet_spec.rb

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants