Permalink
Browse files

testing loaded? method and reducing funcalls

  • Loading branch information...
1 parent 87a319c commit a78547a9c66eeaa3dbf5e2612483ca172fb137e9 @tenderlove tenderlove committed Jul 21, 2010
@@ -259,7 +259,7 @@ def data
end
def loaded?
- !!@data
+ @data
end
def save
@@ -22,6 +22,16 @@ def test_new_record?
s = SqlBypass.new :data => 'foo', :session_id => 10
assert s.new_record?, 'this is a new record!'
end
+
+ def test_not_loaded?
+ s = SqlBypass.new({})
+ assert !s.loaded?, 'it is not loaded'
+ end
+
+ def test_loaded?
+ s = SqlBypass.new :data => 'hello'
+ assert s.loaded?, 'it is loaded'
+ end
end
end
end

0 comments on commit a78547a

Please sign in to comment.