<commit_before># CucumberTricks

Cucumber step definition dsl extension to easily define more readable steps.

## Installation

Add this line to your application's Gemfile:

    gem 'cucumber_tricks', :require => false

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install cucumber_tricks

## Usage

Detailed usage examples can be found on [relish](https://www.relishapp.com/philou/cucumber-tricks/docs)

### Requiring the files

Add `require 'cucumber_tricks' from every steps definition file where you use
it. This will make cucumber work in normal mode as well as in dry-run mode.

### Use pronouns to reference previously introduced items

foo.feature

```gherkin
Given the tool 'screwdriver'
When this tool is used
```

steps.rb

```ruby
A_TOOL = NameOrPronounTransform('tool', 'hammer')

Given /^(#{A_TOOL})$/ do
  ...
end
```

### Use the same step implementation to handle an inline arg as a 1-cell table
### Add default values to the hashes of a table
### Define named lists from a table

## Contributing

1. Fork it<commit_msg>Finish Readme<commit_after># CucumberTricks

Cucumber step definition dsl extension to easily define more readable steps.

## Installation

Add this line to your application's Gemfile:

    gem 'cucumber_tricks', :require => false

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install cucumber_tricks

## Usage

Detailed usage examples can be found on [relish](https://www.relishapp.com/philou/cucumber-tricks/docs)

### Requiring the files

Add `require 'cucumber_tricks' from every steps definition file where you use
it. This will make cucumber work in normal mode as well as in dry-run mode.

### Use pronouns to reference previously introduced items

foo.feature

```gherkin
Given the tool 'screwdriver'
When this tool is used
```

steps.rb

```ruby
A_TOOL = NameOrPronounTransform('tool', 'hammer')

Given /^(#{A_TOOL})$/ do |tool|
  ...
end
```

### Use the same step implementation to handle an inline arg as a 1-cell table

steps.rb

```ruby
GivenEither /^the dog named "(.*)"$)$/,
            /^the following dogs$/ do |dogs_table|
  ...
end
```

foo.feature

```gherkin
Given the dog "Rolphy"
...
Given the following dogs
  | Rex  |
  | King |
  | Volt |
```

### Add default values to the hashes of a table

foo.feature

```gherkin
Given the following dogs
  | names | color |
  | Rex   | white |
  | King  | Sand  |
```

steps.rb

```ruby
Given /^the following dogs$$/ do |dogs|
  hashes = dogs.hashes_with_defaults('names', 'tail' => 'wagging', 'smell' => 'not nice')

#  hashes.each do |hash|
#    expect(hash['smell']).to eq('not nice')
#  end

  ...
end
```

### Define named lists from a table

foo.feature

```gherkin
Given the following dishes
  | Spaghetti Bolognaise | => | Spaghetti | Bolognaise sauce |       |         |
  | Burger               | => | Bread     | Meat             | Salad | Ketchup |
```

steps.rb

```ruby
Given /^the following dishes$$/ do |dishes|
  name_2_dishes = dishes.hash_2_lists

#  expect(name_2_dishes['Burger']).to eq(['Bread','Meat','Salad','Ketchup'])

  ...
end

## Contributing

1. Fork it
{'fraction_non_alphanumeric': 0.1189034109021358, 'fraction_numerical': 0.0022314313037934334, 'mean_word_length': 3.521613832853026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2576207', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1016, 'n_words': 360}