Skip to content

Instantly share code, notes, and snippets.

View lukeredpath's full-sized avatar
🏠
Working from home

Luke Redpath lukeredpath

🏠
Working from home
View GitHub Profile
@lukeredpath
lukeredpath / MockyExpectations.mm
Last active December 10, 2015 16:09 — forked from anonymous/Expectations.mm
Quick preview of the new Mocky syntax. The previous syntax required passing an explicit builder object into the checking block. I tried to work around this with some macros to make it more readable but this seemed generally like a bad idea. The new version keeps macros to a minimum. I also felt the jMock syntax - verbatim - didn't feel quite rig…
- (void)testCanExpectSingleMethodCallAndPass
{
id<SomeProtocol> testObject = [context protocolMock:@protocol(SomeProtocol)];
[context check:^{
[[expectThat(testObject) receives] doSomething];
}];
[testObject doSomething];
@lukeredpath
lukeredpath / sketch.rb
Created June 29, 2012 16:04 — forked from mattwynne/sketch.rb
sketch for Matt Wynne
class Organization
def initialize(parameters = {})
@parameters = parameters
end
def to_param
"42"
end
def valid?
# By default, rspec/rails tags all specs in spec/integration as request specs,
# which is not what we want. There does not appear to be a way to disable this
# behaviour, so this file is a copy of rspec/rails.rb with this default
# behaviour commented out.
require 'rspec/core'
RSpec::configure do |c|
c.backtrace_clean_patterns << /vendor\//
c.backtrace_clean_patterns << /lib\/rspec\/rails/
end
require "active_record"
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:dbfile => "test.sqlite3"
)
ActiveRecord::Schema.define do
create_table "things" do |t|
t.column "flag", :bool
class Array
def move_to_front_of_line(x)
unshift(delete(self[x]))
end
end
#!/usr/bin/env ruby
require 'fileutils'
if ARGV.empty?
puts "Usage: #{__FILE__} <repository> <repository> ..."
exit -1
end
created_flags = []