Skip to content

Instantly share code, notes, and snippets.

View msassak's full-sized avatar

Mike Sassak msassak

View GitHub Profile
require 'strscan'
singleton = <<EOS
Feature: Singletonz
Scenario: Oh hai
Given what is this here
%_FEATURE_END_%
EOS
module LastRequestResponse
def last_request
page.driver.last_request
end
def last_response
page.driver.last_response
end
end
msassak@xanthippe:~/Work/cucumber(api) $ belly
/Users/msassak/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- belly/credentials (LoadError)
from /Users/msassak/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/msassak/.rvm/gems/ruby-1.8.7-p302@cucumber/gems/belly-0.5.5/bin/../lib/belly/client/config.rb:2
from /Users/msassak/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Users/msassak/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/msassak/.rvm/gems/ruby-1.8.7-p302@cucumber/gems/belly-0.5.5/bin/../lib/belly/client.rb:60
from /Users/msassak/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Users/msassak/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:
@msassak
msassak / builder.rb
Created November 22, 2010 08:18
The Gherkin Builder API
require 'gherkin'
require 'gherkin/builder'
gherkin = Gherkin::Builder.new do
feature "Addition" do
description "In order to avoid silly mistakes..."
scenario_outline "Add two numbers" do
step :given, "I have entered <input_1> into the calculator"
step :and, "I have entered <input_2> into the calculator"
# in feature/step_definitions/steps.rb
Given "blah" do
do_it
end
module MoreWorld
extend self
def do_it
p "Do it"
#!/usr/bin/env ruby
require 'csv'
class Converter
def initialize(feature)
@feature = feature
end
def to_gherkin
$ ruby-1.8.7-p302 method_chain.rb
method_chain.rb:2: syntax error, unexpected '.', expecting $end
.gsub(/f/, "")
^
$ ruby-1.9.2-p0 method_chain.rb
OO
| type | doors |
| SD Plus™ Door | 2 |
module NavWorld
class << self
def nav_callbacks
@nav_callbacks ||= {}
end
def under(path, &block)
nav_callbacks[path] = block
end
@msassak
msassak / n2c.erl
Created February 17, 2011 22:56
The simplest thing that can possibly work.
-module(n2c).
-export([n2c/1]).
n2c("255.255.255.255") -> 32;
n2c("255.255.255.254") -> 31;
n2c("255.255.255.252") -> 30;
n2c("255.255.255.248") -> 29;
n2c("255.255.255.240") -> 28;
n2c("255.255.255.224") -> 27;
n2c("255.255.255.192") -> 26;