Created
February 17, 2010 14:49
-
-
Save adamhunter/306672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'test/unit' | |
module Hi | |
def say_hi | |
'hi' | |
end | |
end | |
class Form | |
def self.say_bye | |
'bye' | |
end | |
end | |
class TestForm < Test::Unit::TestCase | |
@@form = Form | |
@@formd = Form.dup | |
Form.send :extend, Hi | |
def test_form_class_has_method_say_hi | |
assert_equal 'hi', Form.say_hi | |
end | |
def test_form_var_has_method_say_hi | |
assert_equal 'hi', @@form.say_hi | |
end | |
def test_formd_var_does_not_have_method_say_hi | |
assert_raises(NoMethodError) { @@formd.say_hi } | |
end | |
def test_form_has_method_say_bye | |
assert_equal 'bye', @@form.say_bye | |
end | |
def test_formd_has_method_say_bye | |
assert_equal 'bye', @@formd.say_bye | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment