Skip to content

Instantly share code, notes, and snippets.

View mattwynne's full-sized avatar

Matt Wynne mattwynne

View GitHub Profile
it 'should do something' do
on_failure warn_that "@foo shouldn't be nil" do
@foo.should_not be_nil
end
end
module ObjectLocators
def the_policy
if @policy
@policy
else
case Policy.count
when 0
raise "There is no @policy variable defined and no policy in the DB! Establish state in previous step or create a new policy."
when 1
@mattwynne
mattwynne / gist:188594
Created September 17, 2009 17:07 — forked from dmeiz/gist:188313
require 'rack/test'
require 'webrat'
require File.expand_path(File.dirname(__FILE__) + '/../../lib/stats')
Webrat.configure do |config|
config.mode = :rack
end
Stats::App.set :environment, 'cucumber'
Stats::App.enable :raise_errors
describe "My Test" do
before(:all) { puts "Running..."}
describe "something" do
it "should have a cool name" do
"name"
end
My view is that we have two domains here - the specification domain, and the execution domain. Gherkin parses the specification model, The compiler translates from the specification model into the execution domain.
The formatters observe the execution, so should operate in that domain. The execution domain model has a mapping to the specification model which created it, so formatters can look up to find out, for example, the feature that a unit comes from, or whether a statement is from a background step or not.
before_features(features) # this allows the formatter to visit the specification model and build whatever representation of that model it wants to (e.g. count scenarios for a progress bar)
before_unit(unit) # unit could be a scenario or example row
before_statement(statement) # statement could be a Before/After hook, a background step or regular step
after_statement(statement, statement_result)
after_unit(unit, unit_result)
after_features
require 'spec_helper'
describe PhotoAlbum do
describe 'adding a new photo' do
describe "when the album has no photos" do
before(:each) do
@photo_album = stub_model(PhotoAlbum)
end
When /^I fill the captcha incorrectly$/ do
captcha_evaluates_to false
end
When /^I fill the captcha correctly$/ do
captcha_evaluates_to true
end
module ShortCircuit
attr_accessor :short_circuit_to
module EventsHelper
def create_events(events_table)
events_table.map_headers! {|header| header.is_a?(Symbol) ? header : header.gsub(/\s/,'_').to_sym }
system_time = TimeService.now
events_table.hashes.each do |event|
event[:name] ||= "Event #{system_time.strftime("%H:%M:%S")}"
event[:enabled] ||= true
event[:time] ||= system_time
#create_club.feature
Scenario: Admin adds a club with valid information
Given I am signed in as an admin with the email "admin@admin.com"
And the city "Barcelona" already exists
And I go to the new club page
When I fill in the following:
| Nombre | Ribelinos |
| Calle | Avda. Diagonal |
| Número | 661 |
[bar, dog, foo, { c => [rat, cat, dog] }, a, b]
- bar
- dog
- foo
- c:
- rat
- cat
- dog
- a