Skip to content
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

Properly support symbol keys in table hashes #840

Closed
dmorgan3405 opened this issue Apr 21, 2015 · 3 comments
Closed

Properly support symbol keys in table hashes #840

dmorgan3405 opened this issue Apr 21, 2015 · 3 comments

Comments

@dmorgan3405
Copy link
Contributor

I would like to reopen the discussion around #313

To solve the issue, I have been using a monkey patch for some time, and wrapped it up in a gem (cucumber-symbolic-hashes)

class Cucumber::Ast::Table

  def symbolic_hashes
    @header_conversion_proc = lambda {|h| symbolize_key(h)}
    @symbolic_hashes ||= build_hashes
  end

  private

  def symbolize_key(key)
    key.downcase.gsub(' ','_').to_sym
  end

end

I know there was a solution discussed in #313 around a hash factory, and that may be a better solution to move forward with. Or possibly there are better options.

I would love to see this ability added to cucumber, as when working in the test data arrangement world it allows me to use factory girl more effectively without having to handling the conversion elsewhere.

If anyone else is interested in seeing a solution added for this I would love discuss it.

@mattwynne
Copy link
Member

@dmorgan3405 thanks for taking an interest. If you can put together a pull request with your solution and specs from http://github.com/dmorgan3405/cucumber-symbolic-hashes I'll be happy to merge it in. The hash factory idea was a lovely idea, but working code is much more valuable than nice ideas :)

@dmorgan3405
Copy link
Contributor Author

Let me know if any revision is needed!

@lock
Copy link

lock bot commented Oct 25, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
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