Sha256: 71dc389df93b6695574e46e7a8746a6c63850c5369ddae3dbfb18b42f0b0d70e
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
Feature: Identify an entity In order to make step definitions more maintainable As a cucumber test developer I want a way to abstract out all the different ways of identifying domain entities Scenario: Given a file named "features/step_definitions/steps.rb" with: """ $: << File.dirname(__FILE__) + '/../../../../lib' require 'cucumber/usual_suspects' class Person < Struct.new(:age, :name) def to_s 'I am a Person'.tap do |result| result << " aged #{age}" unless age.nil? result << " named #{name}" unless name.nil? end end end Identify 'a Person' do as /a Person aged (\d+)/ do |age| Person.new(age.to_i) end as /a Person named (\w+)/ do |name| Person.new(nil, name) end end Given /<a Person> with blonde hair/ do |person| announce "#{person} and I have blonde hair" end """ And a file named "features/test.feature" with: """ Feature: Scenario: Given a Person aged 5 with blonde hair And a Person named Dave with blonde hair """ When I successfully run "cucumber" Then the output should contain "I am a Person aged 5 and I have blonde hair" Then the output should contain "I am a Person named Dave and I have blonde hair"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cucumber-usual_suspects-0.0.1 | features/identify_an_entity.feature |