37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/ccls_engine/assertions.rb', line 37
def assert_should_behave_like_a_hash(*args)
options = {
:key => :key,
:value => :description
}
options.update(args.)
assert_should_require_attribute( options[:key], options[:value] )
assert_should_require_unique_attribute( options[:key], options[:value] )
assert_should_require_attribute_length( options[:key], options[:value],
:maximum => 250 )
test "should find by key with ['string']" do
object = create_object
assert object.is_a?(model_name.constantize)
found = (model_name.constantize)[object.key.to_s]
assert found.is_a?(model_name.constantize)
assert_equal object, found
end
test "should find by key with [:symbol]" do
object = create_object
assert object.is_a?(model_name.constantize)
found = (model_name.constantize)[object.key.to_sym]
assert found.is_a?(model_name.constantize)
assert_equal object, found
end
end
|