Skip to content

Instantly share code, notes, and snippets.

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

Joseph Wilk josephwilk

💭
💻 🎨 🎵
View GitHub Profile
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
@josephwilk
josephwilk / pdf_formatter.rb
Created March 7, 2009 16:31
Pdf formatter for Cucumber 0.1.99
#cucumber --require pdf_formatter.rb --quiet --dry-run --format Cucumber::Formatter::Pdf features/
require 'cucumber/formatter/console'
require 'prawn'
class PdfIO
def initialize
@pdf = Prawn::Document.new :page_size => "A4", :top_margin => 60
end
module TestMe
attr_accessor :poo
end
...
step_mother.World do |w|
w.extend(TestMe)
gem 'term-ansicolor'
require 'term/ansicolor'
if Cucumber::WINDOWS_MRI
begin
gem 'win32console', '>= 1.2.0'
require 'Win32/Console/ANSI'
rescue LoadError
STDERR.puts %{*** WARNING: You must "gem install win32console" (1.2.0 or higher) to get coloured output on MRI/Windows}
Term::ANSIColor.coloring = false
def undefine_task(*names)
app = Rake.application
tasks = app.instance_variable_get('@tasks')
names.flatten.each { |name| tasks.delete(name) }
end
undefine_task('spec')