Today, when I try to run my plugin tests, I’ve needed the answer for this question and I did some research. Here is the answer:
# start console rails c # if you want to start with another env, you can use this command: RAILS_ENV=test rails c
# find your user by login name user = User.where(login: 'admin').first
# set new password like this example user.password = '123456789' user.password_confirmation = '123456789'
# and save the user in last step with this command user.save!