Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error when there is not a logger user #8

Open
IvanGuardado opened this issue Jan 18, 2022 · 0 comments
Open

Getting an error when there is not a logger user #8

IvanGuardado opened this issue Jan 18, 2022 · 0 comments

Comments

@IvanGuardado
Copy link

In some scenarios, I need to test a controller as an anonymous user. However, I'm getting this error if the method set_user is not called.

it 'works' do
  get :index
end
NoMethodError:
       undefined method `cookies' for {}:Hash

When I set a user everything is working properly:

it 'works' do
  warden.set_user("user_id", User.first.id)

  get :index
end

Is there something I'm missing? How is it supposed to test a private controller using an anonymous user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant