Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
def Inherits(*classes)
klass = Class.new classes.shift # inherit from the last clas
while refine_with = classes.shift # include the others as module refinements just so we can turn them into modules
klass.include Module.new { include refine(refine_with) { } }
end
klass
end
@endeepak
endeepak / spec_examples.rb
Created February 12, 2011 09:01 — forked from hosh/spec_examples.rb
rspec-best-practices-and-tips
#http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/
describe User do
subject { user }
let(:user) { User.new }
context "when name empty" do
it { should_not be_valid }
specify { user.save.should be_false }
end