Joh*_*ohn 3 ruby-on-rails-3 railstutorial.org
我正在通过hartl rails教程
我在8.3节的末尾,应用程序运行正常,但我收到了一个rspec错误
1) User pages signup with valid information after saving the user
Failure/Error: it { should have_link('Sign out') }
expected link "Sign out" to return something
# ./spec/requests/user_pages_spec.rb:48:in `block (5 levels) in <top (required)>'
Run Code Online (Sandbox Code Playgroud)
user_pages_spec.rb中涉及的部分是
it "should create a user" do
expect { click_button submit }.to change(User, :count).by(1)
end
describe "after saving the user" do
it { should have_link('Sign out') }
end
Run Code Online (Sandbox Code Playgroud)
关于如何解决这个问题,我有点不知所措.还有其他类似的帖子,但唉,我不能让他们的解决方案在我的情况下工作.谢谢.
在检查链接之前,您似乎需要创建帐户.测试比您发布的更多.这是我在完成教程时使用的代码片段.
describe "after saving the user" do
before { click_button "Create my account" }
it { should have_link('Sign out') }
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
406 次 |
| 最近记录: |