0

我在黄瓜测试中有一系列步骤

我正在填写各种各样的东西

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)我想从中检索属性,但它不允许我这样做。在控制台中工作正常......这可能与cancan授权有关吗?

4

0 回答 0