0
我试图编写一个规范,将测试用户与角色“溢价”可以编辑维基与属性“个人。”。错误消息为规范:未定义的本地变量或方法
这里是我的情况之一(这是一个功能规格)
scenario "it allows premium users to assign collaborators" do
user = create(:user, role: 'premium')
wiki = create(:wiki, personal: true)
r = create(:relationship, wiki_id: wiki.id, user_id: user.id, creator_created: true)
login_as(user, :scope => :user)
visit (edit_wiki_path(wiki))
expect(page).to have_content('Private')
expect(page).to have_content("Select collaborators")
end
该错误消息我得到的是,
Failure/Error: click_on('Edit')
ActionView::Template::Error:
undefined local variable or method `wiki' for #<#<Class:0xb22e920>:0xcb58c0c>
当我尝试去完成所有步骤,用户会通过,我得到相同的错误消息,所以这不仅仅是访问方法的问题。 。 。这里有一个例子:
scenario "it allows premium users to edit Private Wikis" do
wiki = create(:wiki, personal: true)
user = create(:user, role: 'premium')
r = create(:relationship, wiki_id: wiki.id, user_id: user.id, creator_created: true)
login_as(user, :scope => :user)
visit root_path
click_on('View Private Wikis')
click_on('MyString') # the title of the wiki created above
click_on('Edit')
click_button('Save and Parse')
expect(page).to have_content('MyString')
end
这里,错误信息读取,
Failure/Error: click_on('Edit')
ActionView::Template::Error:
undefined local variable or method `wiki' for #<#<Class:0xb22e920>:0xcb58c0c>
有什么想法?
谢谢!
嗨艾伦,请添加完整的错误堆栈跟踪(如果有可用的行号)以及单击编辑时要呈现的视图模板文件的内容。 – 2014-11-25 11:17:52