Skip to content

Instantly share code, notes, and snippets.

View josephwilk's full-sized avatar
💭
💻 🎨 🎵

Joseph Wilk josephwilk

💭
💻 🎨 🎵
View GitHub Profile
default: rails
rails: --require features/support/rails_env --require features/step_definitions/common --require features/step_definitions/rails/ features/rails/
browser: --require features/support/browser_env --require features/step_definitions/common --require features/step_definitions/browser features/browser/
module Cucumber
module Parser
grammar Table
rule record
(cell_value separator record) / cell_value
end
rule separator
'|'
end
@josephwilk
josephwilk / feature_parser.erb
Created December 23, 2008 17:19
Cucumber treetop grammar
module Cucumber
# :stopdoc:
module TreetopParser
grammar Feature
rule root
space? header scenario_sequence space? {
def compile
feature_elements = scenario_sequence.compile
feature = Cucumber::Ast::Feature.new(nil, nil, header.text_value.strip, feature_elements)
feature
@josephwilk
josephwilk / background.feature
Created January 16, 2009 17:25
Background feature for Cucumber
Feature: Backgrounds
In order to provide a context to my scenarios within a feature
As a feature editor
I want to write a background section in my features.
Scenario: run a scenario with a background with a passing step
When I run cucumber -q features/passing_background_sample.feature:6
Then it should pass with
"""
Feature: sample
Scenario Outline: passing background
Then I should have '<count>' cukes
Examples:
| count |
| Background:
Given '10' cukes
10 |
Feature: backgrounds
In order to provide a context to my scenarios within a feature
As a feature editor
I want to write a background section in my features.
Scenario: run a feature with a background that passes
When I run cucumber -q features/passing_background.feature
Then it should pass with
"""
Feature: sample
# trying out the scenario outlines cucumber feature
$ gem list cucumber; gem list webrat
*** LOCAL GEMS ***
cucumber (0.1.16)
webrat (0.4.1)
# the feature we are trying features/manage_cukes.feature
Feature: Manage cukes
In order to use scenario outlines
# the feature we are trying features/manage_cukes.feature
Feature: Manage cukes
In order to use scenario outlines
everything should work
Scenario Outline: Testing scenario outlines # examples/tickets/test.feature:6
Given there are <cuke_versions>
Examples:
| cuke_versions |
#!/usr/bin/env ruby
require 'rubygems'
require 'trollop'
config = {:step_type => 'Given,When,Then'}
opts = Trollop.options do
opt :step_type, "Given, When or Then", :type => :string, :default => config[:step_type]
end
term = ARGV.last
desc "Run cucumber features with real browser"
task :browser => ['features:start', 'cuke_browser']
Cucumber::Rake::Task.new(:cuke_browser) do |t|
t.cucumber_opts = "--profile browser"
t.feature_list = []
t.step_list = []
end
namespace :features do