This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# = Capistrano Passenger deploy tasks | |
# | |
# Provides tasks for deploying a Rails application with Passenger (aka mod_rails). | |
# | |
# Category:: Capistrano | |
# Package:: Passenger | |
# Author:: Simone Carletti <weppos@weppos.net> | |
# Copyright:: 2007-2008 The Authors | |
# License:: MIT License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to find out where a method comes from. | |
# Learned this from Dave Thomas while teaching Advanced Ruby Studio | |
# Makes the case for separating method definitions into | |
# modules, especially when enhancing built-in classes. | |
module Perpetrator | |
def crime | |
end | |
end | |
class Fixnum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hydra = Typhoeus::Hydra.new(3) | |
@responses = [] | |
start_time = Time.now | |
request = Typhoeus::Request.new(:method => :get, :host => "localhost:3000", :path => "/first", :query_string => "delay=1") | |
request.when_complete do | |
@responses << request.response | |
YAML.load(request.response.body)[:path_info].should == "/first" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'typhoeus' | |
require 'yajl/json_gem' | |
hydra = Typhoeus::Hydra.new | |
request = Typhoeus::Request.new('http://localhost:8089/?id=timeline', :method => :post, :body => stuff.to_json) | |
request.on_complete do |response| | |
response.code # http status | |
response.body | |
response.time # time taken in seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux] | |
curb (0.6.2.1) | |
em-http-request (0.2.5) | |
eventmachine (0.12.10) | |
typhoeus (0.1.13) | |
user system total real Memory (Kb) | |
4kb std | |
0.000000 0.000000 3.010000 ( 22.408594) 24,484 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################# | |
# Dependencies in this Gemfile are managed through the gemspec. Add/remove | |
# depenencies there, rather than editing this file ex: | |
# | |
# Gem::Specification.new do |s| | |
# ... | |
# s.add_dependency("sinatra") | |
# s.add_development_dependency("rack-test") | |
# end | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main | |
# urls is a hash containing url to retrieve statuses of items | |
get_csv(urls, items) { |response, item| | |
item_results = CSV.parse_line(response.body) | |
item.setStatus(item_results[0]) | |
} | |
end | |
def process_response(urls, items) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. | |
# It is recommended to regenerate this file in the future when you upgrade to a | |
# newer version of cucumber-rails. Consider adding your own code to a new file | |
# instead of editing this one. Cucumber will automatically load all features/**/*.rb | |
# files. | |
ENV["RAILS_ENV"] ||= "test" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set @@variable_name in a before(:all) block and give access to it | |
# via let(:variable_name) | |
# | |
# Example: | |
# describe Transaction do | |
# set(:transaction) { Factory(:transaction) } | |
# | |
# it "should be in progress" do | |
# transaction.state.should == 'in_progress' | |
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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') |
OlderNewer