1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

README.md: clarified how to include Devise::TestHelpers for :view tests.

Also clarified that including Devise::TestHelpers during integration tests is a mistake.
source: https://github.com/plataformatec/devise/issues/3881
This commit is contained in:
Dave Morse 2016-01-03 16:50:47 -05:00
parent 1d77099861
commit 37b7e9b850

View file

@ -421,6 +421,7 @@ If you're using RSpec, you can put the following inside a file named `spec/suppo
```ruby
RSpec.configure do |config|
config.include Devise::TestHelpers, type: :controller
config.include Devise::TestHelpers, type: :view
end
```
@ -438,7 +439,7 @@ sign_out @user # sign_out(resource)
There are two things that are important to keep in mind:
1. These helpers are not going to work for integration tests driven by Capybara or Webrat. They are meant to be used with functional tests only. Instead, fill in the form or explicitly set the user in session;
1. `Devise::TestHelpers` is not going to work for integration tests driven by Capybara or Webrat. It is meant to be used with functional tests only. Instead, fill in the form or explicitly set the user in session;
2. If you are testing Devise internal controllers or a controller that inherits from Devise's, you need to tell Devise which mapping should be used before a request. This is necessary because Devise gets this information from the router, but since functional tests do not pass through the router, it needs to be stated explicitly. For example, if you are testing the user scope, simply use: