我在黄瓜测试中有一系列步骤
我正在填写各种各样的东西
When I fill in "field" with "data"
fill_in field, with: "data"
And I fill in "nested_field" with "nested data"
然后 我提交 click_button“创建”
之后我想检查对象(及其嵌套对象)是否已在数据库中创建。
Then some objects were created with the data
@new_object = Object.last
@new_object.field == "data"
@nested_object = @new_object.nested
@nested_object.nested.field == "nested data"
问题: 当我的@new_object似乎存在时,@ new_object.field正在返回nil。
知道我怎么做: a)添加测试 当我把@new_object我得到以下
@new_object = Object.last返回 #
@new_object = Object.all
返回
#<Object id: 15, attribute_1: "blah", created_at: "2013-10-30 21:45:01", updated_at: "2013-10-30 21:45:01", end_date: "2015-04-30 00:00:00">
(在数组中,格式化似乎要删除)
这基本上就是我想要的,除了它在数组
中b)我想从中检索属性,但它不会让我。在控制台中工作正常......这可能与康康授权有关吗?