Functional Test with Minitest and Authentication

I am trying to perform a functional test, but I do not know how to deal with cookies. I use Ruby and Minitest to perform functional tests on controllers. But to run the tests in the controllers, I first need to authenticate. Authentication uses cookies to check if a user is registered or not. The problem in functional tests does not show what cookies are, than I can not authenticate and then run the tests. Does anyone give me a hint to resolve this?

thanks heber

+4
source share
1 answer

I also look at the same problem. Being somewhat new to this, I'm not really sure if this will work, but I intend to try using before do hook to trigger authentication.

Something like that:

  before do get :login # fill in and submit end it "must do stuff" do #Test things and hopefully it'll be logged in end 
0
source

Source: https://habr.com/ru/post/1382532/


All Articles