Skip to content

Instantly share code, notes, and snippets.

require File.dirname(__FILE__) + '/../foo_page'
describe FooPage do
before(:all) do
html = File.open(File.dirname(__FILE__) + '/../fixtures/foo.html').read
doc = Capybara.string(html)
@page = FooPage(doc)
end
@hedgehog
hedgehog / cookie_steps.rb
Created November 24, 2011 07:24 — forked from nruth/cookie_steps.rb
Testing login "remember me" feature with Capybara (rack::test or selenium) - deleting the session cookie (only)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@hedgehog
hedgehog / .rvmrc
Created November 21, 2011 14:02
rvmrc issue
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
ruby_id='ruby-1.9.2-p290'
gemset_id='proj'
environment_id="${ruby_id}@${gemset_id}"
@hedgehog
hedgehog / Gemfile
Created November 13, 2011 20:23
Bundler GH issue #1530
source :rubygems
group :guard do
gem 'guard', '~>0.8.4'
gem 'guard-bundler'
gem 'guard-cucumber'
gem 'guard-livereload'
gem 'guard-rspec'
gem 'guard-process'
gem 'guard-shell'
@hedgehog
hedgehog / ebs_raid.rb
Created November 11, 2011 03:59 — forked from tnine/ebs_raid.rb
Ebs raid mounting. Links to this jira issue http://tickets.opscode.com/browse/CHEF-2275
include Opscode::Aws::Ec2
#Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed
# Create multiple resources with new node: PASS
#
# Re-attach multiple resources after a reboot: PASS
#
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS
#
@hedgehog
hedgehog / papertrail_webhook_test.rb
Created November 10, 2011 07:40
Papertrail webhook test client - POSTs JSON to a log processing webhook
#!/usr/bin/ruby -w
# See http://help.papertrailapp.com/kb/how-it-works/web-hooks
require 'yajl'
require 'faraday'
class PapertrailWebhookRequest
def self.connection
Faraday::Connection.new
@hedgehog
hedgehog / gist:1110674
Created July 28, 2011 00:36 — forked from rowan-m/gist:1026918
update jenkins Updatecenter from CLI
$ java -jar jenkins-cli.jar -s http://localhost:9000 install-plugin findbugs
findbugs is neither a valid file, URL, nor a plugin artifact name in the update center
No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
findbugs looks like a short plugin name. Did you mean 'null'?
# Specifying a full URL works!
$ java -jar jenkins-cli.jar -s http://localhost:9020 install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi
# Get the update center ourself
# Removing leftover leases and persistent rules
echo "cleaning up dhcp leases"
rm /var/lib/dhcp3/*
# Make sure Udev doesn't block our network
# http://6.ptmc.org/?p=164
echo "cleaning up udev rules"
DIR_PATH=`readlink -f "/etc/udev/rules.d/70-persistent-net.rules"` # get rid of symlinks and get abs path
rm -rf /etc/udev/rules.d/70-persistent-net.rules
if [[ ! -d "${DIR_PATH}" ]] ; then # now you're testing
source 'http://rubygems.org'
gem 'ruby-libvirt'
gem 'ruby-vnc'