Sha256: a2da5d8b4227a07094ea626aad9aceaa256c5e0afd3eec8ca03fee81299bbe89
Contents?: true
Size: 817 Bytes
Versions: 1
Compression:
Stored size: 817 Bytes
Contents
require "test/unit" require 'smart_init' class TestClass extend SmartInit initialize_with :attribute_1, :attribute_2 end class SmartInitTest < Test::Unit::TestCase def test_number_of_attributes assert_nothing_raised do TestClass.new( "attr_1_value", "attr_2_value" ) end assert_raise ArgumentError do TestClass.new( "attr_1_value" ) end end def test_instance_variables assert_equal test_object.instance_variable_get("@attribute_1"), "attr_1_value" end def test_private_getters assert_raise NoMethodError do test_object.attribute_1 end assert_equal test_object.send(:attribute_1), "attr_1_value" end private def test_object @_test_object ||= TestClass.new("attr_1_value", "attr_2_value") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smart_init-0.1.0 | test/test_smart_init.rb |