提交 761dc68d 编写于 作者: B Brian Christian

additional test assertions (limit and offset)

上级 048fd13c
......@@ -488,6 +488,14 @@ def test_model_class_responds_to_fifth_bang
def test_second_to_last
assert_equal topics(:fourth).title, Topic.second_to_last.title
# test with offset
assert_equal topics(:fourth), Topic.offset(1).second_to_last
assert_equal nil, Topic.offset(5).second_to_last
#test with limit
assert_equal nil, Topic.limit(1).second
assert_equal nil, Topic.limit(1).second_to_last
end
def test_second_to_last_have_primary_key_order_by_default
......@@ -506,6 +514,14 @@ def test_model_class_responds_to_second_to_last_bang
def test_third_to_last
assert_equal topics(:third).title, Topic.third_to_last.title
# test with offset
assert_equal topics(:third), Topic.offset(1).third_to_last
assert_equal nil, Topic.offset(5).third_to_last
# test with limit
assert_equal nil, Topic.limit(1).third
assert_equal nil, Topic.limit(1).third_to_last
end
def test_third_to_last_have_primary_key_order_by_default
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册