DEV: Add order to avoid randomly failing test.

This commit is contained in:
Guo Xiang Tan 2018-10-15 11:42:45 +08:00
parent 5ae4cbcf88
commit aa60936115
2 changed files with 6 additions and 7 deletions

View File

@ -1130,9 +1130,7 @@ class UsersController < ApplicationController
MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id]
render json: {
success: true
}
render json: success_json
end
private

View File

@ -3265,13 +3265,14 @@ describe UsersController do
context 'while logged in' do
before do
sign_in(user)
sign_in(user)
2.times { sign_in(user) }
end
it 'logs user out' do
ids = user.user_auth_tokens.map { |token| token.id }
post "/u/#{user.username}/preferences/revoke-auth-token.json", params: { token_id: ids[0] }
ids = user.user_auth_tokens.order(:created_at).pluck(:id)
post "/u/#{user.username}/preferences/revoke-auth-token.json",
params: { token_id: ids[0] }
expect(response.status).to eq(200)