Skip to content

Instantly share code, notes, and snippets.

@rubyist
Created September 15, 2010 20:16
Show Gist options
  • Select an option

  • Save rubyist/581387 to your computer and use it in GitHub Desktop.

Select an option

Save rubyist/581387 to your computer and use it in GitHub Desktop.
require 'test/unit'
module Stuff
def self.included(base)
base.extend Stuff::ClassMethods
end
module ClassMethods
def foo
'foo'
end
end
def bar
'bar'
end
end
class A
include Stuff
end
class ATest < Test::Unit::TestCase
def test_a_has_bar
assert_equal 'bar', A.new.bar
end
def test_A_has_foo
assert_equal 'foo', A.foo
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment