Skip to content

Instantly share code, notes, and snippets.

View mattwynne's full-sized avatar

Matt Wynne mattwynne

View GitHub Profile
My view is that we have two domains here - the specification domain, and the execution domain. Gherkin parses the specification model, The compiler translates from the specification model into the execution domain.
The formatters observe the execution, so should operate in that domain. The execution domain model has a mapping to the specification model which created it, so formatters can look up to find out, for example, the feature that a unit comes from, or whether a statement is from a background step or not.
before_features(features) # this allows the formatter to visit the specification model and build whatever representation of that model it wants to (e.g. count scenarios for a progress bar)
before_unit(unit) # unit could be a scenario or example row
before_statement(statement) # statement could be a Before/After hook, a background step or regular step
after_statement(statement, statement_result)
after_unit(unit, unit_result)
after_features
Cucumber Cuke4Nuke
|------- invoke ----->|
|<-------- diff ------|
|----- diff result -->|
|<---- step result ---|
Failed: Given the Furtwangler has become vicious on line 7 undefined local variable or method `pending' for nil:NilClass /Users/matt/projects/cucumber/examples/self_test/tmp/features/step_definitions/gherkin_steps.rb:2:in `__instance_exec0'
../../../bin/../lib/cucumber/core_ext/instance_exec.rb:26:in `send'
../../../bin/../lib/cucumber/core_ext/instance_exec.rb:26:in `instance_exec'
../../../bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `cucumber_instance_exec'
../../../bin/../lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
../../../bin/../lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
../../../bin/../lib/cucumber/rb_support/rb_step_definition.rb:55:in `invoke'
../../../bin/../lib/cucumber/step_match.rb:24:in `invoke'
../../../bin/../lib/cucumber/step_mother.rb:132:in `invoke'
../../../bin/../lib/cucumber/step_mother.rb:142:in `execute'
require 'spec_helper'
describe PhotoAlbum do
describe 'adding a new photo' do
describe "when the album has no photos" do
before(:each) do
@photo_album = stub_model(PhotoAlbum)
end
log/*.log
tmp/*
tmp/**/*
doc/api
doc/app
db/*.sqlite3
*.swp
.DS_Store
Feature: Post message
In order to share my thoughts
As a user
I want to post messages
Scenario: Existing User posts a message
Given there is a User
And I am logged in as the User
When I visit the homepage
And I fill in "Message" with "Hello World"
require 'rubygems'
require 'spec'
class Baz
def call_foo_on(subject, &block)
subject.foo(block)
end
end
describe Baz do
require 'rubygems'
require 'spec'
class Baz
def call_foo_on(subject)
block = lambda { |a| a * 2 }
subject.foo(&block)
end
end
When /^I fill the captcha incorrectly$/ do
captcha_evaluates_to false
end
When /^I fill the captcha correctly$/ do
captcha_evaluates_to true
end
module ShortCircuit
attr_accessor :short_circuit_to
matt@Hubba:~$ sudo hostname
sudo: unable to resolve host Hubba
Hubba
matt@Hubba:~$