-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix for issue: #1199: Changed DataTable#symbolic_hashes to not change the state of the table #1200
Fix for issue: #1199: Changed DataTable#symbolic_hashes to not change the state of the table #1200
Conversation
Thanks @Ben-Behar! I'll take a look at this and see what's happening with these failing tests. :) |
So this is an issue with JRuby we've been having in Travis as a result of a new JRuby release. There's a fix on master - would you mind rebasing @Ben-Behar? |
ee2bb9a
to
0b5498b
Compare
Rebase is done. Hopefully my |
Thanks! I'm checking out the appveyor failure but I'm not sure it's because of your code so we may be able to merge anyway. |
@@ -159,8 +159,10 @@ def hashes | |||
# [{:foo => '2', :bar => '3', :foo_bar => '5'}, {:foo => '7', :bar => '9', :foo_bar => '16'}] | |||
# | |||
def symbolic_hashes | |||
@header_conversion_proc = lambda { |h| symbolize_key(h) } | |||
@symbolic_hashes ||= build_hashes |
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.
Is this build_hashes
method used elsewhere? If not I'd delete it. Same with the @header_conversion_proc
- make sure it isn't used elsewhere before deleting it.
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.
build_hashes
is called above on line 147 within the methodhashes
, which in turn is called on line 163.@header_conversion_proc
is used elsewhere and the modification to this variable in@symbolic_hashes
is what is/was causing the issue.
Personally, I wouldn't mind removing usage of @header_conversion_proc
throughout the file as it seems a bit unnecessary. However, I think that is outside the scope of this bugfix.
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.
Sounds good, thanks for clarifying!
It looks like the Appveyor failures are the same ones we already have on master, so I'm going to go ahead and merge this. |
Hi @Ben-Behar, Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾 In return for this generous offer we hope you will:
On behalf of the Cucumber core team, |
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
DataTable#symbolic_hashes will no longer set the instance variable
@header_conversion_proc
but instead will act in a similar manner to DataTable#hashes except returning a new array of hashes with symbolic keys.Details
Changed DataTable#symbolic_hashes to call DataTable#hashes and then map the return value to a new hash with all keys changed to symbols using the method DataTable#symbolize_key(key).
Motivation and Context
Solves the issue reported here #1199
How Has This Been Tested?
Added the following test:
spec/cucumber/multiline_argument/data_table_spec.rb
. This is intended to ensure that after using DataTable#symbolic_hashes, no error is raised when using DataTable#hashes (see issue: #1199 )The test only been run in the following environments so far:
bundle exec rake
Types of changes
Checklist: