我刚刚设置了像这样的工厂女孩的Pickle(features / support / pickle.rb):
Pickle.configure do |config|
config.adapters = [:factory_girl]
config.map 'I', 'myself', 'me', 'my', :to => 'user: "me"'
end
我现在想要开始这样的黄瓜场景:
Given a journal exists with user: me
因此它创建了一个日记模型的实例,当前用户为user_id,但是我收到了这个错误:
Pickle::Session::ModelNotKnownError: The model: 'user: "me"' is not known in this
scenario. Use #create_model to create, or #find_model to find, and store a reference
in this scenario.
如何让Pickle与我相匹配? to current_user?错误消息中的提示并不告诉我如何或在何处存储它。
n.b。我所做的登录步骤已将当前用户存储在@me
答案 0 :(得分:0)
没关系 - 我找到了。将其添加到“我已登录”步骤:
store_model('user', 'me', @me) # Where @me is the logged in user record