- download
- Edit your
.autotestand add this line:Autotest::Growl::image_dir = File.expand_path("~")+'/Dropbox/Public/fu'(or wherever you unpacked fu.zip) - ???????
- Profit!
| # Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html | |
| Hi everyone, I'm Chris Wanstrath. | |
| When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But | |
| then I took a few moments and thought, Wait, why? Why me? What am I supposed | |
| to say that's interesting? Something about Ruby, perhaps. Maybe the | |
| future of it. The future of something, at least. That sounds | |
| keynote-y. | |
| # USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
| require 'nokogiri' | |
| # modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
| class Hash | |
| class << self | |
| def from_xml(xml_io) | |
| begin | |
| result = Nokogiri::XML(xml_io) | |
| return { result.root.name.to_sym => xml_node_to_hash(result.root)} |
| #!/usr/bin/env ruby -w | |
| ###################################### | |
| # A tiny wrapper over optparse that gives easy subcommand facility. | |
| # It also neatly prints help for global and subcommands | |
| # as well as summarizes subcommands in global help. | |
| # | |
| # For updated version, goto : http://github.com/rkumar/subcommand | |
| # | |
| # @author Rahul Kumar, Jun 2010 | |
| # @date 2010-06-20 22:33 |
| Scenario: Get List of My Hitchhiking Items via API | |
| Given the existing things: | |
| |name| | |
| |The Guide (duh)| | |
| |A towel| | |
| |Sub-Etha Sens-O-Matic| | |
| |Pan Galactic Gargle Blaster| | |
| |Kill-o-Zap blaster pistol| | |
| And the existing accounts: | |
| |email|name|password| |
| module Mongoid | |
| module DeepCloning | |
| def deep_clone(attrs = {}, obj = nil) | |
| returning obj || self.class.new do |o| | |
| o.write_attributes(@attributes.merge(attrs).except("_id", "versions").except(*o.class.associations.keys)) | |
| yield o if block_given? | |
| o.save | |
| @attributes.each_pair do |key, value| | |
| next unless proxy = self.associations[key] | |
| case proxy.association |
| require 'md5' | |
| class Chargify::HooksController < ApplicationController | |
| protect_from_forgery :except => :dispatch | |
| before_filter :verify, :only => :dispatch | |
| EVENTS = %w[ test signup_success signup_failure renewal_success renewal_failure payment_success payment_failure billing_date_change subscription_state_change subscription_product_change ].freeze | |
| def dispatch | |
| event = params[:event] |
| class Achievement | |
| class << self | |
| attr_accessor :all | |
| end | |
| self.all = [] | |
| attr_accessor :badge | |
| def initialize(badge) | |
| @badge = badge |
| #!/usr/bin/env ruby | |
| # Evaluates a sample of keys/values from each redis database, computing statistics for each key pattern: | |
| # keys: number of keys matching the given pattern | |
| # size: approximation of the associated memory occupied (based on size/length of value) | |
| # percent: the proportion of this 'size' relative to the sample's total | |
| # | |
| # Copyright Weplay, Inc. 2010. Available for use under the MIT license. | |
I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.
A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.
So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.
