Created
April 16, 2011 15:17
-
-
Save mattraibert/923184 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
require 'minitest/autorun' | |
require 'properties' | |
class PropertiesTest < MiniTest::Unit::TestCase | |
class Foo | |
extend Properties | |
property :bar | |
end | |
def setup | |
@p = Foo.new | |
end | |
def test_property | |
@p.bar = 123 | |
assert_equal 123, @p.bar | |
end | |
def test_crazy_method_missing | |
@p.set_foo 100 | |
assert_equal 100, @p.get_foo | |
end | |
def test_only_matches_beginning | |
assert_raises(NoMethodError){ @p.please_set_foo 100} | |
assert_raises(NoMethodError){ @p.please_get_foo} | |
end | |
def test_method_missing_if_not_in_hash | |
assert_raises(NoMethodError){ @p.get_bang } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment