Skip to content

Instantly share code, notes, and snippets.

View svenfuchs's full-sized avatar

Sven Fuchs svenfuchs

View GitHub Profile
~ $ cat .irbrc
# require 'wirble'
require 'rubygems'
require 'wirble'
Wirble.init(:history_size => 10000)
Wirble.colorize
Wirble::Colorize.colors = {
# delimiter colors
#!/usr/bin/env ruby
# This script copies all .gem files for all versions of a gem from gems.github.com to gemcutter.org.
# For all versions of a gem, it does a gem fetch, repackages the gem with the non-namespaced name,
# and does a gem push. You must have permission to push the gem, so your gemcutter key must be
# set in ~/.gemrc
require 'rubygems'
require 'yaml'
require 'fileutils'
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
Given /^I am on (.+)$/ do |page_name|
visit path_to(page_name)
response.status.should == 200
end
Given "I output the body" do
puts response.body
end
class Attendee
def listen
puts "think: interesting stuff ..."
end
end
module Tweets
def listen
super
puts "tweet: great conference! :D"
module Base
def listen
puts "think: interesting stuff ..."
end
end
class Attendee
include Base
end
ruby -e 'require "rubygems"; require "activesupport"'
/Users/sven/.rvm/gems/ruby/1.9.2/gems/activesupport-2.3.4/lib/active_support/core_ext/try.rb:29: [BUG] rb_add_method: unsupported method type (8)
ruby 1.9.2dev (2009-07-18 trunk 24186) [x86_64-darwin10.2.0]
-- control frame ----------
c:0020 p:---- s:0054 b:0054 l:000053 d:000053 CFUNC :alias_method
c:0019 p:0044 s:0049 b:0049 l:000048 d:000048 CLASS /Users/sven/.rvm/gems/ruby/1.9.2/gems/activesupport-2.3.4/lib/active_support/core_ext/try.rb:29
c:0018 p:0009 s:0047 b:0047 l:000046 d:000046 TOP /Users/sven/.rvm/gems/ruby/1.9.2/gems/activesupport-2.3.4/lib/active_support/core_ext/try.rb:1
# should prefer an element based on the length of the matching value
@html = <<-html
<a href="#">The link with extra text</a>
<a href="http://www.some-very-long-url.com">The link!</a>
html
assert_equal 'The link', locate("The Link").content
# should locate an element containing whitespace
# i want to test/unit test some step definitions (webrat compat steps for steam)
#
# there must be an easier way to do that ... i have to set up the $step_mother globally
# because the steps file is loaded through require, i.e. it wouldn't be reloaded if
# I would set this up in #setup.
#
# this way i can then call something like $step_mother.invoke('I press "button"') in
# my test case.
module PathTo
@svenfuchs
svenfuchs / gist:317630
Created February 28, 2010 15:23
Steam Demo App Cucumber Output
steam-demo $ cucumber features/*.feature
Feature: Managing lists
In order to have a better overview of my tasks
As a control freak
I want to arrange my tasks in lists
Background: # features/managing_lists.feature:6
Given the following tasks: # features/step_definitions/task_steps.rb:1
| name | list |
| Mow the lawn | Garden |
io = IO.popen('tidy', 'w+')
io << html
io.close_write
puts io.readlines.join