Skip to content

Instantly share code, notes, and snippets.

@ordinaryzelig
ordinaryzelig / gist:3375801
Created August 17, 2012 03:56
change.org email
Received: (qmail 12010 invoked from network); 16 Aug 2012 21:44:04 -0000
Received: from unknown (HELO mx-out.facebook.com) ([69.171.232.140])
by 66.11.233.84 with SMTP; 16 Aug 2012 21:44:04 -0000
Return-Path: <[email protected]>
DKIM-Signature: v=1; a=rsa-sha256; d=facebookappmail.com; s=s1024-2011-q2; c=relaxed/simple;
q=dns/txt; [email protected]; t=1345153444;
h=From:Subject:Date:To:MIME-Version:Content-Type;
bh=sdzmpH6zCuJpI2mmOdexkDRtc4bVgUqKmax9LwXmjkw=;
b=JILs+g7DtW/A9bsAu46l1WcCEchKO8WTL92d9kJmkiR3BEcAYeu0DogwK5DuYv61
9l1E4LwXH5uvC6x93v2onLwo8NqP/N+TQi0hPMAR4xPN42/t5q5RGLKgUuKBkUub
@ordinaryzelig
ordinaryzelig / current-single_link.html
Created August 15, 2012 21:36
CaddyShack/Beasts of the Wild link
@ordinaryzelig
ordinaryzelig / .gitignore
Created July 6, 2012 15:22
Include Rails-style initialize method in a class
.rvmrc
Gemfile
Gemfile.lock
@ordinaryzelig
ordinaryzelig / minitest_spec_expectations.md
Last active March 23, 2025 21:22
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations
1) GnipRule
Failure/Error: it { should have_many(:gnip_rule_network_posts)}
ActiveRecord::StatementInvalid:
PGError: ERROR: relation "gnip_rule_network_posts" does not exist
LINE 4: WHERE a.attrelid = '"gnip_rule_network_posts"':...
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"gnip_rule_network_posts"'::regclass
Pending:
HomeController posts exposure exposes posts related to a specific network if params[:timeline_network_type] is given
# Not Yet Implemented
# ./spec/controllers/home_controller_spec.rb:22
ListenersHelper add some examples to (or delete) /Users/ningj/dev/projects/sv_studio/spec/helpers/listeners_helper_spec.rb
# Not Yet Implemented
# ./spec/helpers/listeners_helper_spec.rb:14
Resque::Failure::RetryNotifier stores failures in redis in addition to sending notifications.
# Not Yet Implemented
# ./spec/lib/resque/failure/retry_notifier_spec.rb:202
@ordinaryzelig
ordinaryzelig / Guardfile
Created May 21, 2011 06:44
guard-coffeescript config for entire directory structure
guard 'coffeescript', {
:output => '.compiledJS',
:bare => true
} do
watch %r{(.*/(.+\.coffee))}
end
class Ruby
class << self
define_method :'<3' do
puts 'ZOMG I love you!'
end
end
end
Ruby.send('<3')
// app/views/layouts/application.js.erb
<% update_flash %>
<%= yield %>
// app/views/layouts/application.js.erb
alert(<%= flash[:notice]) %>)