Sha256: 955bf47bd13c61e01a35695c91bad6ec0a6312fb22b07f5ee83067a7e775c71c
Contents?: true
Size: 994 Bytes
Versions: 5
Compression:
Stored size: 994 Bytes
Contents
require File.dirname(__FILE__) + '/../test_helper' class SimpletonTest < Test::Unit::TestCase class TestObject include Simpleton attr_accessor :called def test @called = true :test end end def setup TestObject.instance_variable_set "@instance", nil end def test_instance_class_method assert_kind_of TestObject, TestObject.instance assert_equal TestObject.instance, TestObject.instance end def test_instance_class_method_with_block var = :unchanged TestObject.instance do |i| var = i.test end assert_equal :test, var end def test_method_missing_class_method assert_nothing_raised { TestObject.test } assert TestObject.called end def test_method_missing_class_method_only_calls_methods_that_are_defined_on_instance e = assert_raises(NoMethodError) { TestObject.quack } assert_equal "undefined method `quack' for SimpletonTest::TestObject:Class", e.message end end
Version data entries
5 entries across 5 versions & 1 rubygems