きゅうりのテストに一連のステップがあります
いろいろ詰め込んでます
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認証と関係があるのでしょうか?