Skip to content

Instantly share code, notes, and snippets.

## Cucumber step
Then /^I should see a link called "([^"]*)" in the (.*)$/ do |link_text, section_name|
response.should have_xpath(xpath_of_section(section_name)) do |section|
section.should have_selector("a", :content => link_text)
end
end
## cucumber feature
Feature: Related article links
In order to find more things I am interested in
Given /^I am logged in$/ do
@me_user ||= Factory.create(:user)
visit login_path
fill_in("email_address", :with => @me_user.email_address)
fill_in("password", :with => @me_user.password)
click_button("Log in")
end
;; gist.el --- Emacs integration for gist.github.com
;; Author: Christian Neukirchen <purl.org/net/chneukirchen>
;; Maintainer: Chris Wanstrath <chris@ozmm.org>
;; Contributors:
;; Will Farrington <wcfarrington@gmail.com>
;; Michael Ivey
;; Phil Hagelberg
;; Version: 0.3
;; Created: 21 Jul 2008
>: rake spec
(in /Users/tomtt/created/projects/cucumber-skin/cucumber-skin)
/opt/local/lib/ruby/gems/1.8/gems/dchelimsky-rspec-1.1.99.13/lib/spec/runner/options.rb:86: warning: instance variable @files_loaded not initialized
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/ruby_extensions/string.rb:31: warning: method redefined; discarding old indent
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/node_classes/character_class.rb:13: warning: useless use of a literal in void context
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler.rb:5: warning: global variable `$exclude_metagrammar' not initialized
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/metagrammar.rb:90: warning: method redefined; discarding old space
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/metagrammar.rb:240: warning: method redefined; discarding old space
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/metagrammar.rb:589: warn
>: rake spec
(in /Users/tomtt/created/projects/cucumber-skin/cucumber-skin)
/opt/local/lib/ruby/gems/1.8/gems/dchelimsky-rspec-1.1.99.13/lib/spec/runner/options.rb:86: warning: instance variable @files_loaded not initialized
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/ruby_extensions/string.rb:31: warning: method redefined; discarding old indent
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/node_classes/character_class.rb:13: warning: useless use of a literal in void context
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler.rb:5: warning: global variable `$exclude_metagrammar' not initialized
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/metagrammar.rb:90: warning: method redefined; discarding old space
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/metagrammar.rb:240: warning: method redefined; discarding old space
/opt/local/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib/treetop/compiler/metagrammar.rb:589: warn
@tomtt
tomtt / template.rb
Created March 29, 2009 19:27
Rails template for all tools needed for a cucumbered app
# Ensure rails 2.3.1 is installed
# sudo gem install rails --source http://gems.rubyonrails.org
# The project_name is used to name the databases
project_name = ask("What is the project name?")
# Ignore files that should not be versioned
run "rm public/index.html"
file '.gitignore', <<-EOT
config/database.yml
>: rake
(in /Users/tomtt/created/projects/five/lather)
Finished in 0.004454 seconds
0 examples, 0 failures
/opt/local/lib/ruby/gems/1.8/gems/dchelimsky-rspec-1.1.99.13/lib/spec/example/example_group_methods.rb:214:in `initialize': wrong number of arguments (2 for 1) (ArgumentError)
from /opt/local/lib/ruby/gems/1.8/gems/dchelimsky-rspec-1.1.99.13/lib/spec/example/example_group_methods.rb:214:in `new'
from /opt/local/lib/ruby/gems/1.8/gems/dchelimsky-rspec-1.1.99.13/lib/spec/example/example_group_methods.rb:214:in `execute_examples'
# formatter:
module OptionsGetterSetter
attr_accessor :options
end
module Cucumber
module Formatter
class ScreenShots < Ast::Visitor
def initialize(step_mother, io, options)
super(step_mother)
module OptionsGetterSetter
attr_accessor :options
end
module Cucumber
module Formatter
class ScreenShots < Ast::Visitor
def initialize(step_mother, io, options)
super(step_mother)
@trac_numbers_generated = {}
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
Cucumber::Rails.use_transactional_fixtures
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
require 'webrat'