Rails 3 RSpec +水豚-current_path为零? [英] Rails 3 rspec + capybara - current_path is nil?

查看:79
本文介绍了Rails 3 RSpec +水豚-current_path为零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在users_spec.rb中有这个

I have this in my users_spec.rb

  scenario "Go to contact page" do
    visit "/contact"
    current_path.should == contact_path
  end

运行rspec后,我得到

After running rspec, I get

Failure/Error: current_path.should == contact_path
       expected: "/contact"
            got: nil (using ==)

由于某种原因,current_path似乎返回nil。

For some reason, current_path seem to be returning nil. Is there a configuration that I am missing?

推荐答案

作者答案:

Min Ming Lo


事实证明,由于还包括webrat,因此存在
的某种冲突。我从我的gem文件(我的
一直没有使用)中注释掉了我的webrat。早些时候它已包含在
的其他测试中(也由于那里有许多过时的教程)。

It turns out that because webrat is also included, there was some sort of conflict. I commented out my webrat from my gem file (which I wasn't using anyway). It was included earlier for some other testing (and also due to many outdated tutorials out there).

这篇关于Rails 3 RSpec +水豚-current_path为零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆