Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created October 1, 2008 07:52
Show Gist options
  • Select an option

  • Save michaelklishin/14051 to your computer and use it in GitHub Desktop.

Select an option

Save michaelklishin/14051 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "rubygems"
require "spec"
# aka Cheetah
class AcinonyxJubatus
def speed_limit
120
end
end
module SlightlyUnresponsible
def speed_limit
:enforced_by_law_deep_inside
end
end
# now lets try some biological engineering.
# Make a cheetah run like homo sapiens:
class AcinonyxJubatus
include SlightlyUnresponsible
end
describe AcinonyxJubatus do
before(:each) do
@animal = AcinonyxJubatus.new
end
it 'cannot go faster than 120 km per hour' do
@animal.speed_limit.should == 120
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment