我正在从事这个在线软件工程课程。我正在完成调试一些遗留代码的最后一项作业。通过我所有的cuke和rspec测试后,我提交了作业。我也尝试了几次手动操作应用程序(应用程序是一个博客网站 - 错误是新的/编辑类别引发了错误)。自动编程器给了我这个输出,基本上说所有主要的测试都失败了:
should support creating new categories [50 points] (FAILED)
should support editing existing categories [50 points] (FAILED)
should support editing existing categories [50 points] (FAILED)
Failures:
1) The categories page should support creating new categories [50 points]
Failure/Error: page.search('form[action="/admin/categories/edit"]').size.should == 1
expected: 1
got: 0 (using ==)
# /tmp/rspec20131108-5471-1rm3oh.rb:104:in `block (2 levels) in <top (required)>'
# /tmp/rspec20131108-5471-1rm3oh.rb:9:in `block (3 levels) in <top (required)>'
# /tmp/rspec20131108-5471-1rm3oh.rb:8:in `block (2 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_sandbox.rb:9:in `block (3 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_sandbox.rb:8:in `block (2 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_runner.rb:42:in `block in run_rspec'
# lib/graders/rspec_grader/rspec_runner.rb:33:in `run_rspec'
# lib/graders/rspec_grader/rspec_runner.rb:24:in `run'
# lib/graders/rspec_grader/weighted_rspec_grader.rb:6:in `grade!'
# ./lib/graders/rspec_grader/heroku_rspec_grader.rb:11:in `grade!'
# lib/graders/rspec_grader/hw5_grader.rb:13:in `grade!'
# ./grade5:33:in `<main>'
2) The categories page should support editing existing categories [50 points]
Failure/Error: page.search('form[action="/admin/categories/edit"]').size.should == 1
expected: 1
got: 0 (using ==)
# /tmp/rspec20131108-5471-1rm3oh.rb:119:in `block (2 levels) in <top (required)>'
# /tmp/rspec20131108-5471-1rm3oh.rb:9:in `block (3 levels) in <top (required)>'
# /tmp/rspec20131108-5471-1rm3oh.rb:8:in `block (2 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_sandbox.rb:9:in `block (3 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_sandbox.rb:8:in `block (2 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_runner.rb:42:in `block in run_rspec'
# lib/graders/rspec_grader/rspec_runner.rb:33:in `run_rspec'
# lib/graders/rspec_grader/rspec_runner.rb:24:in `run'
# lib/graders/rspec_grader/weighted_rspec_grader.rb:6:in `grade!'
# ./lib/graders/rspec_grader/heroku_rspec_grader.rb:11:in `grade!'
# lib/graders/rspec_grader/hw5_grader.rb:13:in `grade!'
# ./grade5:33:in `<main>'
3) The categories page should support editing existing categories [50 points]
Failure/Error: page.search('form[action="/admin/categories/edit"]').size.should == 1
expected: 1
got: 0 (using ==)
# /tmp/rspec20131108-5471-1rm3oh.rb:134:in `block (2 levels) in <top (required)>'
# /tmp/rspec20131108-5471-1rm3oh.rb:9:in `block (3 levels) in <top (required)>'
# /tmp/rspec20131108-5471-1rm3oh.rb:8:in `block (2 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_sandbox.rb:9:in `block (3 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_sandbox.rb:8:in `block (2 levels) in <top (required)>'
# lib/graders/rspec_grader/rspec_runner.rb:42:in `block in run_rspec'
# lib/graders/rspec_grader/rspec_runner.rb:33:in `run_rspec'
# lib/graders/rspec_grader/rspec_runner.rb:24:in `run'
# lib/graders/rspec_grader/weighted_rspec_grader.rb:6:in `grade!'
# ./lib/graders/rspec_grader/heroku_rspec_grader.rb:11:in `grade!'
# lib/graders/rspec_grader/hw5_grader.rb:13:in `grade!'
# ./grade5:33:in `<main>'
除了我所有的黄瓜测试通过,当我手动运行应用程序时,它工作得很好。无论我是通过单击按钮手动输入它试图到达或通过它的路径,一切都呈现得很好。有关为什么会发生这种情况的任何想法?是的,每当我手动和通过黄瓜运行时,我都在使用管理员帐户(因为这是管理员应该访问的功能)。
非常感谢任何指导。如果您需要查看文件,请在评论中告诉我,我会将其添加进去。我只是不知道这个错误可能在哪里。谢谢。
答案 0 :(得分:0)
错误表明缺少HTML元素:form
action
属性为/admin/categories/edit
。您的网页是否有与之匹配的元素?
答案 1 :(得分:0)
结果证明我的Ruby版本和自动编程器的Ruby版本存在问题。这就是为什么它在本地工作并通过我自己的测试,但当它与自动编程器连接时,一些非常基本的测试失败了。