Ruby on rails 水豚模糊误差
我的应用程序是基于Rails 3的,它设计了用户身份验证,我发现了这个错误。如何解决这个错误Ruby on rails 水豚模糊误差,ruby-on-rails,ruby-on-rails-3,ruby-on-rails-3.2,Ruby On Rails,Ruby On Rails 3,Ruby On Rails 3.2,我的应用程序是基于Rails 3的,它设计了用户身份验证,我发现了这个错误。如何解决这个错误 bin/cucumber features/signing_up.feature Rack::File headers parameter replaces cache_control after Rack 1.5. Using the default profile... Feature: Signing up In order to be attributed for my work As
bin/cucumber features/signing_up.feature
Rack::File headers parameter replaces cache_control after Rack 1.5.
Using the default profile...
Feature: Signing up
In order to be attributed for my work
As a user
I want to be able to sign up
Scenario: Signing up # features/signing_up.feature:6
Given I am on the homepage # features/step_definitions/web_steps.rb:44
When I follow "Sign up" # features/step_definitions/web_steps.rb:56
Ambiguous match, found 2 elements matching link "Sign up" (Capybara::Ambiguous)
./features/step_definitions/web_steps.rb:57:in `/^(?:|I )follow "([^"]*)"$/'
features/signing_up.feature:8:in `When I follow "Sign up"'
And I fill in "Email" with "user@ticketee.com" # features/step_definitions/web_steps.rb:60
And I fill in "Password" with "password" # features/step_definitions/web_steps.rb:60
And I fill in "Password confirmation" with "password" # features/step_definitions/web_steps.rb:60
And I press "Sign up" # features/step_definitions/web_steps.rb:52
Then I should see "You have signed up successfully." # features/step_definitions/web_steps.rb:105
Then I should see "Please confirm your account before signing in." # features/step_definitions/web_steps.rb:105
Failing Scenarios:
cucumber features/signing_up.feature:6 # Scenario: Signing up
1 scenario (1 failed)
8 steps (1 failed, 6 skipped, 1 passed)
0m0.272s
步骤定义:57
When /^(?:|I )follow "([^"]*)"$/ do |link|
click_link(link)
end
routes.rb
Ticketee::Application.routes.draw do
devise_for :users, :controllers => { :registrations => "registrations" }
get '/awaiting_confirmation', :to => "users#confirmation", :as => 'confirm_user'
resources :projects do
resources :tickets
end
root :to => "projects#index"
namespace :admin do
root :to => "base#index"
resources :users
end
这是从书中获取的routes.rb,在书中,测试通过但未通过我的测试如果链接位于其他样式(如类或id)中,您可以使用:
within(<whatever class or id>) do
click_link(link)
end
in()do
单击链接(链接)
结束
或者强制它单击第一个链接,您可以先使用链接(:link,link)。单击。
如果使用此方法,您将需要类似于all(link)[1]的内容。单击稍后点击“注册”按钮。我已经尝试了第一次(:link,link)。单击但它会引发未初始化的常量RegistrationController(ActionController::RoutingError)
但是我已经有了这个控制器,在本书的前几章中,我当前的问题处理得很好,所以可能第一个链接不是正确的,有没有办法让它使用第二个链接?请参阅我在上面的答案末尾加上的额外部分-全部(链接)[1]。单击
将点击第二个链接。我已经添加了它,因此我的步骤如下:当/^(?:| i)跟随“([^”]*)”$/do | link | first(:link,link)。单击全部(link)[1]。单击结束
,它将引发未初始化的常量注册控制器(ActionController::RoutingError)
againBTW,您得到的未初始化常量
错误与单击错误链接无关-这是您的路由.rb
的问题。它找不到您的注册控制器。您可以检查此控制器的第一行是类注册控制器文件名是app/controllers/registrations\u controller.rb
。