Skip to content

Instantly share code, notes, and snippets.

View justinko's full-sized avatar

Justin Ko justinko

  • Colorado, USA
  • 14:31 (UTC -07:00)
  • LinkedIn in/jko170
View GitHub Profile
@justinko
justinko / delegate.rb
Created May 21, 2011 21:46
A simple delegate to an array
require 'forwardable'
class BenArray
extend Forwardable
def initialize
@array = []
end
def_delegators :@array, :select, :reject, :<<
describe PostsController do
describe "PUT #update" do
let(:post) { Factory(:post) }
context "when logged in as post's author" do
before { sign_in post.author }
it "allows the post to be updated" do
do_action
response.should be_success
@justinko
justinko / module_stubbing.rb
Created December 22, 2011 19:52 — forked from myronmarston/module_stubbing.rb
Avdi Grimm's creation, pulled from Objects on Rails
module ModuleStubbing
def stubbed_modules
@stubbed_modules ||= []
end
def stub_module(full_name)
most_shallow_stubbed_module = nil
full_name.to_s.split(/::/).inject(Object) do |context, name|
begin
class NullLogger < Logger
def initialize(*args); end
def write(*input); true; end
end
Rails.application.assets.logger = NullLogger.new
class TemporaryLoggerLevel
LEVEL = Logger::ERROR
Merchant Date Ends Deal Price Value
Burger King 10/2/2011 10/4/2011 Your way 25 50
McDonalds 10/5/2011 Not really food 22 44
Arbys 10/8/2011 10/10/2011 More burgers 7 14
@justinko
justinko / .rspec
Last active December 15, 2015 00:39 — forked from reinh/.rspec
--colour
-I app