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

More versatile row value access. #118

Merged
merged 1 commit into from
Jun 22, 2017

Conversation

enkessler
Copy link
Contributor

Summary

Added a method to allow the retrieval of a value in an AST Row by using the example table parameter that corresponds to it.

Details

Cucumber::Core::Ast::ExamplesTable::Row now has a #[] method.

Motivation and Context

I wanted to be able to retrieve a value from a row without having to know ahead of time which position it would be in in the array returned by #values. I also didn't want to have to go through the effort of determining the index on the fly by accessing the header object, finding the index of the parameter name and then using that as the index for the value array. I just wanted a way to say "Hey, row! Give me the value that you used for this parameter!"

How Has This Been Tested?

There's a spec for it.

There were a few failings specs but they were already failing and, given the very narrow nature of my change, are certainly not my fault.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I've added tests for my code
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Added a method to allow retrieving a row value by it's corresponding parameter.

Added a method to allow retrieving a row value by it's corresponding parameter.
@enkessler enkessler requested a review from mattwynne May 25, 2017 17:18
it 'returns the actual row values' do
row = ExamplesTable::Row.new({'x' => '1', 'y' => '2'}, 1, location, language, comments)
expect( row.values ).to eq ['1', '2']
end

it "can access a row value by it's parameter name" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/it's/its/

:)

I always get this wrong myself but it's easier to see in other people's stuff!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I fixed one typo and introduced another. Truly, I am making this project a better place. :P

@mattwynne mattwynne merged commit da7a24d into cucumber:master Jun 22, 2017
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Mar 21, 2018
## [3.0.0](cucumber/cucumber-ruby-core@v3.0.0.pre.2...v3.0.0) (2017-09-27)

### Changed

* Step#name renamed to #text ([#137](cucumber/cucumber-ruby-core#137) [@olleolleolle](https://github.com/olleolleolle))
* Use past tense in event names (`xStarting` -> `xStarted`) (see [cucumber/cucumber-ruby#1166](cucumber/cucumber-ruby#1166) @brasmusson).

### Added

* Do not create test cases for scenarios with no steps ([#144](cucumber/cucumber-ruby-core#144) @brasmusson)
* Handle selective strict settings ([#143](cucumber/cucumber-ruby-core#143) @brasmusson)

### Fixed

* Fix DataTable's Location to be aware of all of its lines ([#142](cucumber/cucumber-ruby-core#142) @botandrose)

### Improved

* As per [#251](cucumber/common#251): renamed History.md to CHANGELOG.md, added contributing message at beginning, and misc formatting. ([#145](cucumber/cucumber-ruby-core#145) [jaysonesmith](https://github.com/jaysonesmith))

## [3.0.0.pre.2](cucumber/cucumber-ruby-core@v2.0.0...3.0.0.pre.2) (2017-07-26)

### New Features

* Add a flaky result type to be used for flaky scenarios ([#141](cucumber/cucumber-ruby-core#141), [cucumber/cucumber-ruby#1044](cucumber/cucumber-ruby#1044) @brasmusson)
* Make the Summary report able to say if the total result is ok ([#140](cucumber/cucumber-ruby-core#140) @brasmusson)
* Replay previous events to new subscribers ([#136](cucumber/cucumber-ruby-core#136) @mattwynne)
* Ruby 2.4.0 compatibility ([#120](cucumber/cucumber-ruby-core#120) @junaruga)
* Use tag expressions ([#116](cucumber/cucumber-ruby-core#116) @brasmusson)
* Access example table row data by param name ([#118](cucumber/cucumber-ruby-core#118) @enkessler)

### Bugfixes

N/A

### Removed Features

N/A

### Refactoring

* Travis: jruby-9.1.10.0 ([#130](cucumber/cucumber-ruby-core#130) @olleolleolle)
* Travis: jruby-9.1.12.0 ([#133](cucumber/cucumber-ruby-core#132) @olleolleolle)
@lock
Copy link

lock bot commented Oct 24, 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 24, 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

Successfully merging this pull request may close these issues.

2 participants