test/hashr_test.rb in hashr-0.0.16 vs test/hashr_test.rb in hashr-0.0.17
- old
+ new
@@ -75,9 +75,21 @@
hashr = Hashr.new
hashr.foo = 'foo'
assert_equal 'foo', hashr.foo
end
+ test 'method using a string key works' do
+ hashr = Hashr.new
+ hashr['foo'] = 'foo'
+ assert_equal 'foo', hashr.foo
+ end
+
+ test 'using a symbol key works' do
+ hashr = Hashr.new
+ hashr[:foo] = 'foo'
+ assert_equal 'foo', hashr.foo
+ end
+
test 'defining defaults' do
klass = Class.new(Hashr) do
define :foo => 'foo', :bar => { :baz => 'baz' }
end
assert_equal 'foo', klass.new.foo