- http://david.heinemeierhansson.com/2014/tdd-is-dead-long-live-testing.html
- http://blog.8thlight.com/uncle-bob/2014/04/25/MonogamousTDD.html
- http://david.heinemeierhansson.com/2014/test-induced-design-damage.html
- http://blog.8thlight.com/uncle-bob/2014/05/01/Design-Damage.html
- http://david.heinemeierhansson.com/2014/slow-database-test-fallacy.html
- http://blog.8thlight.com/uncle-bob/2014/04/30/When-tdd-does-not-work.html
- https://www.destroyallsoftware.com/blog/2014/tdd-straw-men-and-rhetoric
- http://articles.coreyhaines.com/posts/active-record-spec-helper/
- http://martinfowler.com/bliki/UnitTest.html
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
diff --git i/hash.c w/hash.c | |
index 007508a..6f39e47 100644 | |
--- i/hash.c | |
+++ w/hash.c | |
@@ -2402,6 +2402,28 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash) | |
return ary; | |
} | |
+static int | |
+hash_comprised_i(VALUE key, VALUE value, VALUE arg) |
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
namespace :database do | |
task fat_tables: :environment do | |
c = ActiveRecord::Base.connection | |
max_table_name_width = 0 | |
tables = c.tables.sort_by do |t| | |
max_table_name_width = t.length if t.length > max_table_name_width |
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
class AddIndexOnClientApplicationIdForOauthTokens < ActiveRecord::Migration | |
def ddl_transaction(&block) | |
# hack because AR 3.x doesn't support the `disable_ddl_transaction!` | |
# method that AR 4.x introduced yet. | |
block.call # do not start a transaction | |
end | |
def change | |
# using raw SQL because ActiveRecord 3.x doesn't support concurrent | |
# migrations yet, in AR 4 this would be: |
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 string_benchmark.rb | |
Calculating ------------------------------------- | |
single quote 128800 i/100ms | |
double quote 128351 i/100ms | |
------------------------------------------------- | |
single quote 6144842.6 (±5.4%) i/s - 30654400 in 5.008373s | |
double quote 6089768.4 (±6.4%) i/s - 30290836 in 5.000430s | |
Comparison: | |
single quote: 6144842.6 i/s |
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
# Public: Matcher for asserting specific merge vars content contains something. | |
# | |
# merge_var_key - Key of the merge var whose content will be checked | |
# expected_data - Data to look for in the specified merge var key. | |
# | |
# WelcomeMailer is an instance of MandrillMailler::TemplateMailer | |
# | |
# let(:user) { FactoryGirl.create(:user) } | |
# let(:mailer) { WelcomeMailer.welcome_registered(user) } | |
# it 'should have the correct data' do |
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
diff --git i/hash.c w/hash.c | |
index 007508a..6f39e47 100644 | |
--- i/hash.c | |
+++ w/hash.c | |
@@ -2402,6 +2402,28 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash) | |
return ary; | |
} | |
+static int | |
+hash_contain_i(VALUE key, VALUE value, VALUE arg) |
I hereby claim:
- I am olivierlacan on github.
- I am olivierlacan (https://keybase.io/olivierlacan) on keybase.
- I have a public key whose fingerprint is 657E 4315 B9D1 4DA4 EC57 152C 8AF8 9C6A 1FF9 AF6D
To claim this, I am signing this object:
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
# located in lib/pumper/nickel.rb | |
# the only way Back.setup works inside of #add_crappy_music | |
# is if I add the following: | |
# require "pumper/nickel/back" | |
# | |
# Why? | |
module Pumper | |
class Nickel < ActiveRecord::Base | |
def add_crappy_music |
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
Warning: you should require 'minitest/autorun' instead. | |
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"' | |
From: | |
/Users/olivierlacan/rails41app/.bundle/bundler/gems/rails-8003c541f7e6/activesupport/lib/active_support/dependencies.rb:247:in `require' | |
/Users/olivierlacan/rails41app/.bundle/bundler/gems/rails-8003c541f7e6/activesupport/lib/active_support/dependencies.rb:247:in `block in require' | |
/Users/olivierlacan/rails41app/.bundle/bundler/gems/rails-8003c541f7e6/activesupport/lib/active_support/dependencies.rb:232:in `load_dependency' | |
/Users/olivierlacan/rails41app/.bundle/bundler/gems/rails-8003c541f7e6/activesupport/lib/active_support/dependencies.rb:247:in `require' | |
/Users/olivierlacan/rails41app/.bundle/gems/shoulda-matchers-2.4.0/lib/shoulda/matchers/assertion_error.rb:10:in `<module:Matchers>' | |
/Users/olivierlacan/rails41app/.bundle/gems/shoulda-matchers-2.4.0/lib/shoulda/matchers/assertion_error.rb:2:in `<module:Shoulda>' | |
/Users/olivierlacan/rails41app/.bundle/gems/should |