Fix all the errors to get our tests green on Rails 5.1.

This commit is contained in:
Guo Xiang Tan
2017-08-31 12:06:56 +08:00
parent 898ee93547
commit 77d4c4d8dc
989 changed files with 5114 additions and 3117 deletions

View File

@ -1,9 +1,33 @@
module IntegrationHelpers
def create_user
get "/u/hp.json"
expect(response).to be_success
body = JSON.parse(response.body)
honeypot = body["value"]
challenge = body["challenge"]
user = Fabricate.build(:user)
post "/u.json", params: {
username: user.username,
email: user.email,
password: 'asdasljdhaiosdjioaeiow',
password_confirmation: honeypot,
challenge: challenge.reverse
}
expect(response).to be_success
body = JSON.parse(response.body)
User.find(body["user_id"])
end
def sign_in(user)
password = 'somecomplicatedpassword'
user.update!(password: password)
Fabricate(:email_token, confirmed: true, user: user)
xhr :post, "/session.json", login: user.username, password: password
post "/session.json", params: { login: user.username, password: password }
expect(response).to be_success
end
end