Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# git pre-commit hook
#
# This will ensure 100% code coverage and all specs passing before allowing a commit
# to the git repo.
#
# Place the file at .git/hooks/pre-commit and use chmod a+x to make it executable.
system('rake clean >/dev/null 2>&1')
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
#!/usr/bin/env ruby
require 'rubygems'
require 'tempfile'
require 'nokogiri'
require 'rdiscount'
# makers-mark
#
# Generates HTML from Markdown, replacing code blocks with syntax
default: -r features/support/env.rb -r features/support/plain.rb -r features/step_definitions features/plain
selenium: -r features/support/env.rb -r features/support/enhanced.rb -r features/step_definitions features/enhanced
| Religion | Pork | Lamb | Veal |
| Christian | Y | Y | Y |
| Jewish | | Y | Y |
| Muslim | | Y | Y |
| Hindu | Y | Y | |
| Atheist | Y | Y | Y |
Scenario Outline: Religious menus
Given I am "<Religion>"
When I ask to see a menu
Then I should be presented a menu with meats entrees
<Meats>
And I should be presented a menu with hamburger types
<Hamburgers>
Examples:
@bmabey
bmabey / 01_original_customer_spec.rb
Created June 18, 2009 04:19 — forked from diabolo/customer_spec.rb
macro example and variations
describe Customer, "last billing address" do
before do
@customer = Customer.generate!
@customer = Address.new
end
it "should be settable and gettable" do
@customer.last_billing_address = @account_address
@customer.last_billing_address.should == @account_address
end
...
# code
class ExternalDataApi
def initialize(setup)
# do stuff to setup
end
def list_of_things
# grabs stuff from the api and returns an array of OStructs
end
end
@bmabey
bmabey / ex1_1.scm
Created September 19, 2009 20:56 — forked from redsquirrel/gist:189190
; Exercise 1.1. Below is a sequence of expressions. What is the result printed by the interpreter in
; response to each expression? Assume that the sequence is to be evaluated in the order in which it is
; presented.
10
; => 10
(+ 5 3 4)
; => 12
(- 9 1)
; => 8
@bmabey
bmabey / ex1_2.scm
Created September 19, 2009 20:58 — forked from redsquirrel/gist:189191
SICP Exercise 1.2
; Translate the following expression into prefix form http://mitpress.mit.edu/sicp/full-text/book/ch1-Z-G-3.gif
; The gif is horrible quality.. so some integers may be wrong....
(/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5)))))
(* 3 (- 6 2) (- 2 7)))