Skip to content

Instantly share code, notes, and snippets.

View rsutphin's full-sized avatar

Rhett Sutphin rsutphin

  • Human Practice, Inc.
  • Chicago, Illinois
View GitHub Profile
@rsutphin
rsutphin / time_ext.rb
Created June 25, 2012 19:50
Demonstrates an issue with selective core_ext and Time.=== on ActiveSupport 3.2.4-3.2.6
ACTIVESUPPORT_SOURCE = ARGV.pop
if ACTIVESUPPORT_SOURCE
if File.directory?(ACTIVESUPPORT_SOURCE)
puts "Using ActiveSupport from #{ACTIVESUPPORT_SOURCE}"
$LOAD_PATH << ACTIVESUPPORT_SOURCE
else ACTIVESUPPORT_SOURCE
puts "Using ActiveSupport gem version #{ACTIVESUPPORT_SOURCE}"
require 'rubygems'
gem 'activesupport', ACTIVESUPPORT_SOURCE
@rsutphin
rsutphin / .gitignore
Created April 19, 2012 04:15
Demonstrating an issue with Bundler.with_clean_env and local path installs (#1858)
.bundle
Gemfile.lock
local-bundle
@rsutphin
rsutphin / .gitignore
Created February 7, 2012 00:17
Example for a question about jar-packaged gems in JRuby
aker-gems.jar
gem_home
@rsutphin
rsutphin / foo_spec.rb
Created November 10, 2011 04:53
RSpec: `let`s leak across examples when invoked from before(:all)
puts "rspec-core #{RSpec::Core::Version::STRING}"
class InstantiationCounter
def initialize(k)
$count ||= { }
$count[k] ||= 0
$count[k] += 1
@k = k
end
@rsutphin
rsutphin / Gemfile
Created October 18, 2011 18:38
Minimal Gemfile for bundler #1486
source :rubygems
gem 'i18n', '~> 0.4'
gem 'activesupport', '~> 3.0'
gem 'activerecord', '~> 3.0'
gem 'builder', '~> 2.1.2'
@rsutphin
rsutphin / a_spec.rb
Created October 17, 2011 16:23
RSpec 2.7.0: Problem with full_description
describe 'A' do
describe '#foo' do
it 'is generally okay' do; end
describe 'subconcern' do
it 'has common behavior' do; end
describe 'case 1' do
it 'does the right thing' do; end
end
@rsutphin
rsutphin / Gemfile
Created October 17, 2011 14:28
RSpec 2.7.0: rcov task does not work
source :rubygems
gem 'rake'
gem 'rspec', '~> 2.7.0'
gem 'rcov'
@rsutphin
rsutphin / Gemfile
Created September 2, 2011 19:15
ActiveRecord 3.1 does not restore connection inheritance after removing a connection from a model
source :rubygems
gem 'activerecord', '~> 3.1.0'
gem 'sqlite3'
@rsutphin
rsutphin / Gemfile
Created September 1, 2011 23:02
ActiveRecord 3.1 cannot load models with non-default PKs unless there's already a database connection
source :rubygems
gem 'activerecord', ENV['AR_VERSION'] || '3.1.0'
gem 'sqlite3', '~> 1.3.4'
@rsutphin
rsutphin / fakefs-encodings-test.rb
Created August 25, 2011 22:07
Demonstrating two encoding-related issues for fakefs
# encoding: UTF-8
def test(env)
fn = 'foo'
File.open(fn, 'w:UTF-8') { |f| f.write '☃' }
begin
puts "Read from #{env} file: #{File.read(fn, :encoding => 'UTF-8')}"
rescue => e