Ruby on rails 3 第9章测试失败的RubyonRails教程
我是Rails的新手,正在阅读Michael Hartl的RubyOnRails教程。。。我已经阅读了第9章类似的问题,但我没有解决我自己的问题,所以这里是我的github存储库和失败的测试。。。也许有人能帮我,非常感谢;) 现在它有5个错误Ruby on rails 3 第9章测试失败的RubyonRails教程,ruby-on-rails-3,Ruby On Rails 3,我是Rails的新手,正在阅读Michael Hartl的RubyOnRails教程。。。我已经阅读了第9章类似的问题,但我没有解决我自己的问题,所以这里是我的github存储库和失败的测试。。。也许有人能帮我,非常感谢;) 现在它有5个错误 1) UserPages edit with valid information Failure/Error: fill_in "Confirm Password", with: user.password Capybara::ElementNot
1) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
2) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
3) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
4) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
5) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
1)使用有效信息编辑用户页面
失败/错误:在“确认密码”中填写:user.Password
Capybara::ElementNotFound:
无法填写,找不到id、名称或标签为“确认密码”的文本字段、文本区域或密码字段
#(评估):2:填写“填写”
#./spec/requests/user\u pages\u spec.rb:81:in'block(4级)in'
2) 使用有效信息编辑用户页面
失败/错误:在“确认密码”中填写:user.Password
Capybara::ElementNotFound:
无法填写,找不到id、名称或标签为“确认密码”的文本字段、文本区域或密码字段
#(评估):2:填写“填写”
#./spec/requests/user\u pages\u spec.rb:81:in'block(4级)in'
3) 使用有效信息编辑用户页面
失败/错误:在“确认密码”中填写:user.Password
Capybara::ElementNotFound:
无法填写,找不到id、名称或标签为“确认密码”的文本字段、文本区域或密码字段
#(评估):2:填写“填写”
#./spec/requests/user\u pages\u spec.rb:81:in'block(4级)in'
4) 使用有效信息编辑用户页面
失败/错误:在“确认密码”中填写:user.Password
Capybara::ElementNotFound:
无法填写,找不到id、名称或标签为“确认密码”的文本字段、文本区域或密码字段
#(评估):2:填写“填写”
#./spec/requests/user\u pages\u spec.rb:81:in'block(4级)in'
5) 使用有效信息编辑用户页面
失败/错误:在“确认密码”中填写:user.Password
Capybara::ElementNotFound:
无法填写,找不到id、名称或标签为“确认密码”的文本字段、文本区域或密码字段
#(评估):2:填写“填写”
#./spec/requests/user\u pages\u spec.rb:81:in'block(4级)in'
说:
在访问编辑用户路径之前,您忘记了登录
编辑:
至于第二个问题,请参见Rails教程中的等效链接。比较您的用户页面\u spec.rb和:您可以看到您正在尝试填写一个确认密码字段和一个确认密码字段,其中只有一个字段实际存在于您的应用程序中 说:
在访问编辑用户路径之前,您忘记了登录
编辑:
至于第二个问题,请参见Rails教程中的等效链接。比较您的用户页面\u spec.rb和:您可以看到您正在尝试填写一个确认密码字段和一个确认密码字段,其中只有一个字段实际存在于您的应用程序中 在运行测试套件之前,请确保使用rails控制台为每个用户提供有效的记忆令牌。请遵循8.2.4的精确说明。在运行测试套件之前,请确保使用rails控制台为每个用户提供有效的记忆令牌。请按照8.2.4进行操作,以获得准确的说明。感谢您的回复,我已更正了5个错误。我已经比较了你给我的代码,我认为是正确的。谢谢你的回复,我已经更正了,但仍然有5个错误。我比较了你给我的代码,我认为是正确的。
before do
sign_in user
visit edit_user_path(user)
end
1) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
2) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
3) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
4) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
5) UserPages edit with valid information
Failure/Error: fill_in "Confirm Password", with: user.password
Capybara::ElementNotFound:
cannot fill in, no text field, text area or password field with id, name, or label 'Confirm Password' found
# (eval):2:in `fill_in'
# ./spec/requests/user_pages_spec.rb:81:in `block (4 levels) in <top (required)>'
describe "edit" do
let(:user) { FactoryGirl.create(:user) }
before { visit edit_user_path(user) }
# ...
end