我正在运行 rails 3.0.0, rspec-rails 2.0.0.beta.20, webrat 0.7.2.beta.1, cucumber-rails 0.3.2 我有这种情况:
Scenario:
Given I am on the new account page
And I fill in "Name" with "John Doe"
When I press "Create"
Then I should be on the access page
当我运行它时,我得到:
expected: "/access",
got: "/accounts"
就像它不遵循控制器中的 redirect_to 一样:
#accounts_controller.rb
def create
@account = Account.new(params[:account])
if @account.save
flash[:notice] = "Saved!"
redirect_to access_url
else
flash[:alert] = "Error!"
render :new
end
end
我错过了一步吗?我认为 webrat 遵循所有重定向。谢谢
使用launchy gem,我得到一个页面,上面写着:
“您正在被重定向”,带有指向 access_path 的链接
?