Skip to content

Instantly share code, notes, and snippets.

View mattwynne's full-sized avatar

Matt Wynne mattwynne

View GitHub Profile
require 'set'
class Decomposer
def initialize params
@uv_gen = params[:uv_gen]
@qu_gen = params[:qu_gen]
@qv_gen = params[:qv_gen]
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
module Monkey
def self.extend_every(args)
class_to_extend = args.keys.first
module_to_extend_with = args.values.first
class_to_extend.instance_eval <<-PATCH
def new(*args)
super(*args).extend(#{module_to_extend_with})
end
PATCH
module Monkey
def self.extend_every(args)
class_to_extend = args.keys.first
module_to_extend_with = args.values.first
class_to_extend.instance_eval <<-PATCH
def new(*args)
super(*args).extend(#{module_to_extend_with})
end
PATCH
Scenario Outline: Permissions
Given I am logged in as <User Type>
When I go to the homepage
Then I should see <Stuff I should see>
And I should not see <Stuff I should not see>
Examples:
| User Type | Stuff I should see | Stuff I should not see |
| Admin | New Invoice, New Category, New Project | |
| User | New Invoice, New Category | New Project |
module DoesStuffAroundFeatures
def visit_feature(feature)
puts "About to run feature #{feature.name}"
super
puts "I just finished that feature"
end
end
Cucumber.configure do |config|
config.extend_primary_visitor DoesStuffAroundFeatures
@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
module Main
where
import Test.HUnit
import Cities
main = runTestTT tests
tests = TestList [
"check" ~: 1 ~?= 0,
describe "My Test" do
before(:all) { puts "Running..."}
describe "something" do
it "should have a cool name" do
"name"
end