1 require File.dirname(__FILE__) + '/../test_helper'
3 class SimpletonTest < Test::Unit::TestCase
18 TestObject.instance_variable_set "@instance", nil
21 def test_instance_class_method
22 assert_kind_of TestObject, TestObject.instance
23 assert_equal TestObject.instance, TestObject.instance
25 def test_instance_class_method_with_block
27 TestObject.instance do |i|
30 assert_equal :test, var
33 def test_method_missing_class_method
34 assert_nothing_raised { TestObject.test }
35 assert TestObject.called
37 def test_method_missing_class_method_only_calls_methods_that_are_defined_on_instance
38 e = assert_raises(NoMethodError) { TestObject.quack }
39 assert_equal "undefined method `quack' for SimpletonTest::TestObject:Class", e.message