Sha256: 2d54a1313118f07ad113f0ae09c1244b300dbf83a1ff5e3fdd88342338dbc53a
Contents?: true
Size: 1.2 KB
Versions: 6
Compression:
Stored size: 1.2 KB
Contents
require 'securerandom' module CmQuiz module Review class LoginUser < BaseReview def initialize(project_api:) @project_api = project_api @verb = :post @path = '/access-tokens' end def run name = "codementor-test-#{SecureRandom.hex(5)}" email = "#{name}@codementor.io" password = "pAssw0rd!" Factory::User.new({ project_api: @project_api, name: name, email: email, password: password }).create @options = build_options(email: email, password: password) res = send_request(@options) payload = JSON.parse(res.body) expect(payload['jwt'].class).to eq(String), '`jwt` should be string' expect(payload['refresh_token'].class).to eq(String), '`refresh_token` should be string' rescue => e build_test_result(self.class, false, e.message) end private def build_options(email:, password:) options = { body: { email: email, password: password } } end def send_request(options) @project_api.request(@verb, @path, options) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems