提交 87a319cd 编写于 作者: A Aaron Patterson

testing new_record? and converting to an attribute

上级 f5de56f5
......@@ -231,7 +231,9 @@ def drop_table!
end
end
attr_reader :session_id
attr_reader :session_id, :new_record
alias :new_record? :new_record
attr_writer :data
# Look for normal and marshaled data, self.find_by_session_id's way of
......@@ -244,10 +246,6 @@ def initialize(attributes)
@new_record = @marshaled_data.nil?
end
def new_record?
@new_record
end
# Lazy-unmarshal session state.
def data
unless @data
......
......@@ -17,6 +17,11 @@ def test_create_table
SqlBypass.drop_table!
assert !Session.table_exists?
end
def test_new_record?
s = SqlBypass.new :data => 'foo', :session_id => 10
assert s.new_record?, 'this is a new record!'
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册