Open JeanMertz opened 11 years ago
Another issue, which I believe to be related to this, is the fact that cookies.signed
causes errors when using with FocusedControllers:
1) SessionsController SessionsController::Create For valid authentication deletes signup session
Failure/Error: When { subject.call }
ArgumentError:
A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb
The secret token is set, and works both in the development environment as well as integration tests, it only fails on FocusedController unit tests.
I solved the second error (was caused by using Rails'4.0.0.beta1
).
See: https://github.com/JeanMertz/focused_controller/commit/15816665c52818ef5f21dde75911850ed6ada105
def cookie_jar
- @cookie_jar ||= ActionDispatch::Cookies::CookieJar.new
+ key = ActionDispatch::Cookies::GENERATOR_KEY
+ @cookie_jar ||= ActionDispatch::Cookies::CookieJar.new(key)
end
See the below specification:
The first two pass, the last one fails. I was under the impression that I should be able to access cookie data in my
FocusedController
specs (I have includedFocusedController::RSpecHelper
) but onlysession
seems to be available here?Here is the error stacktrace: