Skip to content

Instantly share code, notes, and snippets.

@monde
Forked from joevandyk/gist:916256
Created April 12, 2011 21:27
Show Gist options
  • Save monde/916453 to your computer and use it in GitHub Desktop.
Save monde/916453 to your computer and use it in GitHub Desktop.
require 'test/unit'
module M
def f
# WINNING
self.class::CONSTANT + 1
end
end
class C
CONSTANT = 1
include M
end
class D
CONSTANT = 2
include M
end
class TestIt < Test::Unit::TestCase
def test_c
assert_equal 2, C.new.f
end
def test_d
assert_equal 3, D.new.f
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment