Sim*_*ner 7 redirect ruby-on-rails cucumber capybara
我正在尝试为黄瓜和水豚的新rails 3应用程序设置集成/验收测试.(我最初计划使用webrat,但它似乎不支持rails 3,所以我最终使用了capybara)
我正在尝试进行基本的登录测试:
Feature: Login user
In order to access the non-public parts of the site,
as a user,
I want to login to the site
Scenario: login with valid credentials
Given I am on the login page
When I fill in "Email" with "bender@planetexpress.com"
And I fill in "Password" with "pass"
And I press "Login"
Then I should be on the users home page
And I should see "Login successful"
Run Code Online (Sandbox Code Playgroud)
现在的问题是,登录表单将我发送给我/user_session
,然后将我重定向到用户主页/home
.黄瓜不遵循导致Then I should be on the users home page
线路失败的重定向.
我如何告诉黄瓜/水豚遵循重定向,以便在按下链接按钮后我在右页?
follow_redirect!
我正在使用的rack_test驱动程序中似乎有一个方法,但它是私有的,我不知道如何调用该功能.
先谢谢,
西蒙
tri*_*ine 14
Capybara自动跟随重定向.别的东西坏了.
将其添加到您的步骤中:
When /^I dump.* the response$/ do
puts body
end
Run Code Online (Sandbox Code Playgroud)
然后,当您的测试行为不端时,您可以添加"我将响应转储"到您的步骤,并查看重定向或其他任何内容.
归档时间: |
|
查看次数: |
10911 次 |
最近记录: |