:wave: Hi <@U9VHUPVPX>, me again I'm having troub...
# pact-ruby
r
👋 Hi @Beth (pactflow.io/Pact Broker/pact-ruby), me again I'm having trouble with authenticating the user in the pact. Something to do with the Warden middleware (I think). I found your gist https://gist.github.com/bethesque/203e9d2ec08f4a40d2df but am not sure what exactly I would put in
RealApp
Apparently we don't normally run a real server for our rspec tests (except for system/capybara ones). When I try to authenticate a user i get this
Copy code
# RuntimeError: Invalid strategy current_user
# from /Users/rachelbingham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/warden-1.2.9/lib/warden/proxy.rb:385:in `_fetch_strategy'
Just wondering if you have any insight on how I might configure this so I can authenticate requests realistically?
b
The example in https://gist.github.com/bethesque/203e9d2ec08f4a40d2df isn't "running a real app" - it's still just a rack app.
I'd be looking at the testing utilities for warden.
otherwise, you need to set up real users in your database for each verification, and make sure that the auth creds you're passing in to each request are valid, and that can be a pain to manage.
typically, I turn off auth for pact tests. that can usually be covered elsewhere in the testing pyramid.
ie. if you have integration tests that go through the UI, the auth has to be covered there anyway.
r
Ah, I see. Thanks for that. Will check it out.