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
# I have a class that delegates functionality to a couple of objects that it | |
# constructs. I want to test this in isolation. I want to make sure that the | |
# objects are constructed with the right arguments. I also want to make sure | |
# that the results from the objects are handled correctly. | |
# | |
# I'm finding it hard to structure the code and test in a way that isn't | |
# cumbersome. What's below works, but it feels like a lot of stubbing and setup | |
# for something the should be simpler. | |
# |
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 password_required? | |
!persisted? || password.present? || password_confirmation.present? | |
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
Failure/Error: Unable to find matching line from backtrace | |
SQLite3::SQLException: cannot start a transaction within a transaction: begin transaction | |
# /Users/jaredfraser/.rvm/gems/ruby-1.9.3-p0-falcon/gems/sqlite3-1.3.5/lib/sqlite3/database.rb:97:in `close' | |
# /Users/jaredfraser/.rvm/gems/ruby-1.9.3-p0-falcon/gems/sqlite3-1.3.5/lib/sqlite3/database.rb:97:in `ensure in prepare' | |
# /Users/jaredfraser/.rvm/gems/ruby-1.9.3-p0-falcon/gems/sqlite3-1.3.5/lib/sqlite3/database.rb:97:in `prepare' | |
# /Users/jaredfraser/.rvm/gems/ruby-1.9.3-p0-falcon/gems/sqlite3-1.3.5/lib/sqlite3/database.rb:134:in `execute' | |
# /Users/jaredfraser/.rvm/gems/ruby-1.9.3-p0-falcon/gems/sqlite3-1.3.5/lib/sqlite3/database.rb:484:in `transaction' | |
# /Users/jaredfraser/.rvm/gems/ruby-1.9.3-p0-falcon/bundler/gems/rails-ee6e3c128b72/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:304:in `block in begin_db_transaction' | |
# /Users/jaredfraser/.rvm/gems/ruby-1.9.3-p0-falcon/bundler/gems/rails-ee6 |
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
RSpec.configure do |config| | |
counter = -1 | |
config.after(:each) do | |
counter += 1 | |
if counter > 9 | |
GC.enable | |
GC.start | |
GC.disable | |
counter = 0 |
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
var Inspect = { | |
TYPE_FUNCTION: 'function', | |
// Returns an array of (the names of) all methods | |
methods: function(obj) { | |
var testObj = obj || self; | |
var methods = []; | |
for (prop in testObj) { | |
if (typeof testObj[prop] == Inspect.TYPE_FUNCTION && typeof Inspect[prop] != Inspect.TYPE_FUNCTION) { | |
methods.push(prop); | |
} |
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
From 2fb8432982b7e8ffc4c05f912f47cd9ca7261427 Mon Sep 17 00:00:00 2001 | |
From: Xavier Shay <xavier@rhnh.net> | |
Date: Sun, 1 May 2011 10:25:18 +1000 | |
Subject: [PATCH] Disable some edge cases in requiring to speed it up. | |
--- | |
load.c | 1 + | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
diff --git a/load.c b/load.c |
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
module Resque | |
class Task | |
attr_accessor :parent, :args | |
attr_accessor :queue, :failed_at, :payload, :exception, :error, :backtrace, :worker | |
def initialize(options={}) | |
options['parent'] = options.delete('class') | |
options.each do |opt, val| | |
self.send("#{opt}=", val) | |
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
2011-05-03 14:06:47.659 mate[24716:903] An uncaught exception was raised | |
2011-05-03 14:06:47.663 mate[24716:903] connection went invalid while waiting for a reply | |
2011-05-03 14:06:47.664 mate[24716:903] *** Terminating app due to uncaught exception 'NSInvalidReceivePortException', reason: 'connection went invalid while waiting for a reply' | |
*** Call stack at first throw: | |
( | |
0 CoreFoundation 0x941356ba __raiseError + 410 | |
1 libobjc.A.dylib 0x9348f509 objc_exception_throw + 56 | |
2 CoreFoundation 0x941353e8 +[NSException raise:format:arguments:] + 136 | |
3 CoreFoundation 0x9413535a +[NSException raise:format:] + 58 | |
4 Foundation 0x998bb0f4 -[NSConnection sendInvocation:internal:] + 4205 |
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
features = `git log | grep Feature:` | |
bugs = `git log | grep Bugfix:` | |
refactors = `git log | grep Refactor:` | |
out = "" | |
out += "Features:\n" | |
out += features.gsub('Feature:', "") | |
out += "Bugfixes:\n" | |
out += bugs.gsub('Bugfix:', "") | |
out += "Refactors:\n" | |
out += refactors.gsub('Refactor:', "") |
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
module ActiveSupport | |
module CoreExtensions | |
module Array | |
module Conversions | |
def to_sentence | |
self.join(' and ') | |
end | |
end | |
end | |
end |