Skip to content

Instantly share code, notes, and snippets.

View mrmemes-eth's full-sized avatar
⚗️
creating

Stephen Caudill mrmemes-eth

⚗️
creating
View GitHub Profile
# usage:
# field_labeled('Select your address').should have_option("Home Address")
Spec::Matchers.define :have_option do |expected|
def options_for(select_field)
select_field.options.map(&:inner_text)
end
match do |select_field|
raise "Field is not a SelectField" unless select_field.kind_of?(Webrat::SelectField)
options_for(select_field).include?(expected)
# not so much like this:
class PeterParkerController < ApplicationController
def show
expose(:spider){ 'to radiation' }
end
end
# as like this:
class PeterParkerController < ApplicationController
expose(:spider){ 'to radiation' }
Röyksoppp, 11/19 - The Regency Ballroom (http://www.coasttocoasttickets.com/buy/san_francisco_ca.htm?pid=1176889)
Anti Pop Consortium, 11/20 - Mojito (http://www.sunsetpromotions.net/events/57845/Antipop-Consortium--Mojito)
DJ Nu Mark, 11/21 - The Mighty (http://www.sfstation.com/dj-nu-mark-e739571)
Cunning Lynguists and Pep Love, 11/21 - (http://www.ticketmaster.com/Cunninlynguists-Plus-Pep-Love-tickets/artist/1367539)
Dethklok and Mastodon, 11/21 - San Jose State University Event Center (http://www.livenation.com/edp/eventId/412063)
@mrmemes-eth
mrmemes-eth / gibbon.rb
Created October 10, 2009 17:35
Gibbon is a monkey patch to provide Given/When/Then templates for RSpec and Webrat integration tests
module Spec::DSL::Main
alias :Feature :describe
def Story(description)
@description_args.push("\n#{description}\n")
end
end
module Spec::Example::ExampleGroupMethods
def executes(scope=:all, &blk)
before(scope, &blk)
@mrmemes-eth
mrmemes-eth / spec_helper.rb
Created September 22, 2009 02:21
necessary configurations for using RSpec with Webrat for integration tests
require 'webrat'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false # optional, but keeps me sane
end
Spec::Runner.configure do |config|
@mrmemes-eth
mrmemes-eth / report_improved.rb
Created June 16, 2009 02:18
First pass at a more Ruby-like Report class from the example in Design Patterns in Ruby, Chapter 3 [for hashrocket bookclub]
class Report
attr_accessor :preamble, :before, :after, :prologue
def initialize
@subject = 'Monthly Report'
@content = ['Things are going', 'Really, really good!']
end
def generate
[:preamble,:head,:body,:prologue].map do |meth|
send(meth)
end.compact.join("\n")
@mrmemes-eth
mrmemes-eth / .screenrc
Created October 16, 2008 01:22
My screenrc. liberally infuenced by _why's.
escape "^Ll"
setenv LC_CTYPE en_US.UTF-8
defutf8 on
autodetach on
crlf off
deflogin off
hardcopy_append on
startup_message off