it 'works with a valid password' do
# have to do this (or write an integration test) since devise does stuff
# from inside of the router and blows up otherwise
@request.env["devise.mapping"] = Devise.mappings[:user]
post :create, user: { email: user.email, password: user.password }, access_token: access_token, format: :json
expect(response).to have_http_status(:created)
end
it 'fails with an invalid password' do
@request.env["devise.mapping"] = Devise.mappings[:user]
post :create, user: { email: user.email, password: 'asdfasdfisdf8981u23123' }, access_token: access_token, format: :json
expect(response).to have_http_status(:unauthorized)
end
the positive case passes, but on the failure case i get this nobrainer error:
note that nobrainer isn't being used at all in this test.
writing the same test as an integration test works fine and doesn't result in the error, i expect it's got something to do with devise and the router but i don't have the time to dig too deep right now.
(this is a weird and probably rare occurrence so i'm just logging it for posterity)
i have a controller setup with devise and mounted like so in my routes:
if i setup a functional test for this like so:
the positive case passes, but on the failure case i get this nobrainer error:
note that nobrainer isn't being used at all in this test.
writing the same test as an integration test works fine and doesn't result in the error, i expect it's got something to do with devise and the router but i don't have the time to dig too deep right now.