When running a request spec test that requires authentication you will need to have the web clients session set up accordingly, which would involve making the necessary requests to log in. Eg, you could have something like,
before do
post('/login', params: { client_id:
client.id, password: 'test-password' })
end
So you might have something like this,
before do
sign_in client
end
Hope this helps. The code examples may not be exactly correct as I am typing them in mostly from memory, with the aid of Google.
Regards,
Joe