This file contains hidden or 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
module ModuleStubbing | |
def stubbed_modules | |
@stubbed_modules ||= [] | |
end | |
def stub_module(full_name) | |
most_shallow_stubbed_module = nil | |
full_name.to_s.split(/::/).inject(Object) do |context, name| | |
begin |
This file contains hidden or 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
the request body |
This file contains hidden or 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
day = case self.type | |
when 'fast' then :fast_completion_day | |
when 'super_fast' then :super_fast_completion_day | |
when 'ludicrous' then :ludicrous_completion_day | |
else :budget_completion_day | |
end | |
self.value = Increment.first.max_hours * Incrementor.first.send(day) |
This file contains hidden or 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
# Toss this in your ~/.irbrc file for a convenient way | |
# to peruse Ruby source code in TextMate. | |
# | |
# Use in irb like so: | |
# | |
# >> require 'active_record' | |
# >> ActiveRecord::Base.source_for_method(:create) | |
class Object | |
def source_for_method(method) |
This file contains hidden or 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
module Starfish | |
module AwsS3 | |
# S3Archive initializes and provides archival-oriented access to an S3 bucket. | |
class S3Archive | |
def initialize | |
config = YAML.load_file("#{File.expand_path('~')}/.ec2/aws-secret.yml") | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => config['aws']['access_key'], |
This file contains hidden or 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 'httpclient' | |
require 'vcr' | |
require 'savon' | |
require 'test/unit' | |
VCR.config do |c| | |
c.cassette_library_dir = 'fixtures/cassettes' | |
c.stub_with :webmock | |
end |
NewerOlder