开发者

Any other reasons an rspec click_link test would fail?

I am doing the example app from the Ruby on Rails 3 tutorial book. I have setup 5 rspec tests to test if there are specific links on the homepage and they point to the right places. 4 of the 5 tests pass but the last one does not. It says:

Failures:
  1) LayoutLinks should have the right links on the layout
     Failure/Error: click_link "Sign up now!"
     Could not find link with text or title or id "Sign up now!"
     # ./spec/requests/layout_links_spec.rb:40:in `block (2 levels) in <top (required)>'

The problem is that 开发者_开发问答I have a link with anchor text "Sign up now!". All the other tests that test for links pass. Is there any other reason this would be failing?

Thanks


It would probably help to know that the click_link function actually visits that page. Since the "Sign up now!" button is only visible from the "Home" page, the "Home" test has to be immediately before the "Sign up now!" test.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜