🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

kappamaki

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kappamaki

bundlerRubygems
Version
1.0.0
Version published
Maintainers
1
Created
Source

Kappamaki Code Climate Coverage Status

Tools for natural, high-level, sophisticated Cucumber steps.

The name comes from the sushi roll filled with pieces of cucumber, which adds naturalness and freshness to a meal.

Usage

Kappamaki provides a number of helper methods that can be used directly in your Cucumber step definitions.

from_sentence

Parses a list of values from a sentence.

Given the restaurant offers cucumber rolls, philadelphia rolls, and avocado rolls

Your step definition would look like this:

Given /^the restaurant offers (.+)$/ do |menu_list|

  # menu_list is this string:
  'cucumber rolls, philadelphia rolls, and avocado rolls'

  # Let's parse this into an array
  menu = Kappamaki.from_sentence menu_list

  # The result, menu, is this array:
  ['cucumber rolls', 'philadelphia rolls', 'avocado rolls']

  # Now we can set up our menu here...
end

attributes_from_sentence

Parses key-value pairs from natural sentences.

When I order a dinner with starter: "miso soup" and entree: "cucumber rolls"

Your step definition would look like this:

When /^I order a dinner with (.+)$/ do |order_items|

  # order_items is this string:
  'starter: "miso soup" and entree: "cucumber rolls"'

  # Let's parse that string using Kappamaki
  order_data = Kappamaki.attributes_from_sentence(order_items)

  # The result, order_data, is this hash:
  { starter: "miso soup",
    entree: "cucumber rolls" }

  # now we can set up our order...
  create :order, order_data
end

symbolize_keys_deep

Converts the keys of a hash into symbols.

Then I am served these items
  | name          | count |
  | miso soup     | 1     |
  | cucumber roll | 8     |

Your step definition would look like this:

Then ^I am served these items do |entrees|
  entrees.hashes.each do |entree|

    # entree is this hash:
    { 'name' => 'miso soup', 'count' => '1' }

    # Let's convert the keys to symbols.
    Kappamaki.symbolize_keys_deep! entree

    # Now entree is this hash:
    { name: 'miso soup', count: '1' }

    # Now we can use this hash in places that expect hashes with symbols
    expect(order).to include entree
  end
end

Installation

  • add gem 'kappamaki' to your application's Gemfile
  • run bundle install
  • add require 'kappamaki' to your /features/support/env.rb file

Contributing

  • Fork it ( https://github.com/Originate/kappamaki/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

FAQs

Package last updated on 22 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts