-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
gherkin: Cucumber-Ruby integration #444
Conversation
The testing of Cucumber-Ruby should not require that test features are written to the file system, therefor gherkin needs to provide an interface for passing the feature file content as a string - as it does v5.x.x.
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.
Review comments in-passing: Solid, tiny change, which opens up that related PR - while being self-contained.
gherkin/ruby/lib/gherkin/gherkin.rb
Outdated
args = args.concat(@paths) | ||
stdin, stdout, stderr, wait_thr = Open3.popen3(*args) | ||
stdin.close | ||
messages = ProtobufCucumberMessages.new(stdout, stderr).messages |
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.
Does this assignment (and the same one in the next method) do anything?
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.
No, it could/should be removed.
gherkin/ruby/lib/gherkin/gherkin.rb
Outdated
stdin.binmode | ||
stdin.write(encode_source_message(uri, data)) | ||
stdin.close | ||
messages = ProtobufCucumberMessages.new(stdout, stderr).messages |
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.
(This assignment, does it do anything?)
gherkin/ruby/lib/gherkin/gherkin.rb
Outdated
ProtobufCucumberMessages.new(stdout).messages | ||
args.push("--default-dialect=#{@default_dialect}") unless @default_dialect.nil? | ||
args | ||
end |
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.
👏 These extracted method are mega-helpful.
dialect.rb provides a public interface to Cucumber-Ruby.
gherkin/ruby/lib/gherkin/gherkin.rb
Outdated
wrapper_obj = Cucumber::Messages::Wrapper.new | ||
wrapper_obj.source = source_obj | ||
buf = Cucumber::Messages::Wrapper.encode(wrapper_obj) | ||
buf[1..-1] # A leading "\n" needs to be removed |
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.
Why is there an extra \n
at the beginning?
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 have absolutely know idea, but without this line the the gherkin-go binary will print
failed to parse Gherkin: parse message: proto: Source: wiretype end group for non-group
to stderr.
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 found the problem. Protobuf messages written to gherkin-go's STDIN should not be wrapped in a Wrapper object. The Wrapper object is only necessary when the reader expects different kinds of messages.
|
I updated the API a little to conform with the API in Java/JavaScript. Use this instead: messages = Gherkin.from_paths(paths) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Changes for the Cucumber-Ruby integration.
Details
Implement theUse the--dialects
options correctly in the go binary--dialects
option (that only works in the binaries built for dist), so thatgherkin/ruby/lib/gherkin/gherkin-languages.json
can be removed.Motivation and Context
See Details.
How Has This Been Tested?
The automated test are updated to cover this functionality
Types of changes
Checklist: