Skip to content

Instantly share code, notes, and snippets.

View msassak's full-sized avatar

Mike Sassak msassak

View GitHub Profile
@msassak
msassak / after.rb
Created December 17, 2009 21:47 — forked from jnicklas/after.rb
require 'cucumber/rails/capybara'
msassak:~/Work/gherkin(master)$ gem list albacore
*** LOCAL GEMS ***
albacore (0.1.2)
msassak:~/Work/gherkin(master)$ irb
ruby-1.8.7-p174 > require 'albacore'
NameError: uninitialized constant RunCommand::AttrMethods
from /home/msassak/.rvm/gems/ruby/1.8.7/gems/albacore-0.1.2/lib/albacore/support/runcommand.rb:4
from /home/msassak/.rvm/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
require 'cucumber'
require 'cucumber/ast/table'
def dittoize(table)
rows = table.rows
rows.each_cons(2) do |upper, lower|
next unless lower.any? { |cell| cell == "''" }
lower.each_with_index do |cell, idx|
lower[idx] = upper[idx] if cell == "''"
Running cucumber --tags ~@wire
Pre INDENT change:
Failing Scenarios:
cucumber features/cucumber_cli.feature:428 # Scenario: Run a single background which matches a name using --name (Useful if there is an error in it)
cucumber features/default_snippets.feature:5 # Scenario: Cucumber doesn't know what language, and defaults to Ruby
cucumber features/exception_in_before_block.feature:21 # Scenario: Handle Exception in standard scenario step and carry on
cucumber features/exception_in_before_block.feature:47 # Scenario: Handle Exception in Before hook for Scenario with Background
cucumber features/html_formatter.feature:6 # Scenario: Everything in examples/self_test
Given "foo bar" do
if @stub
puts "I am stubbed"
else
puts "I am not stubbed"
end
end
Before('@stub') do
@stub = true
Feature: scenario outline test
Scenario Outline: main table for now
Given an event starts at <TimeA> in <CreateTMZ>
When a user in <ViewTMZ> views the event
Then it will show as starting at <TimeB>
And <Note>
Examples:
| CreateTMZ | TimeA | ViewTMZ | TimeB | Note |
module TestWorld
def log_in
puts "Logging in"
end
def log_out
puts "Logging out"
end
end
class Cucumber::Ast::Table
def expand_dittos(ditto = "''")
ditto_rows = rows.dup
ditto_rows.each_cons(2) do |upper, lower|
next unless lower.any? { |cell| cell == ditto }
lower.each_with_index do |cell, idx|
lower[idx] = upper[idx] if cell == ditto
end
end
#
# With Gherkin 2.0 we do something like this:
def parse
builder = Cucumber::Parser::GherkinBuilder.new
formatter_listener = Gherkin::Parser::FormatterListener.new(builder)
filter_listener = Gherkin::Parser::FilterListener.new(formatter_listener, filters)
parser = Gherkin::Parser::Parser.new(filter_listener, true, "root")
lexer = Gherkin::I18nLexer.new(parser, false)
lexer.scan(source, location, offset)
Feature: Pipes Are the Waves of the Future
Scenario: This is a scenario living in a gist
Given a step blah
And another one
Then McGlarble
Scenario: Real step
Then STDERR should be empty