Sha256: c78d82ff3f26fd87635627636be513e5d3fddf0cb92c2a62bd9ec4b0d9f92414
Contents?: true
Size: 785 Bytes
Versions: 6
Compression:
Stored size: 785 Bytes
Contents
require 'securerandom' module CmQuiz module Factory class User def initialize(project_api:, name: nil, email: nil, password: nil) @project_api = project_api @name = name || "codementor-test-#{SecureRandom.hex(5)}" @email = email || "#{@name}@codementor.io" @password = password || "pAssw0rd!" end def create options = { body: { email: @email, name: @name, password: @password } } res = @project_api.request(:post, '/users', options) payload = JSON.parse(res.body) [payload['jwt'], payload['refresh_token']] rescue => e raise StandardError, "Create test user failed, reason: #{e.message}" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems