Sha256: 4fceb7902040347fccf893da2a0871eb7977bac225db3b0437995a8c51ff0852
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 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' 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cm_quiz-0.0.2 | lib/cm_quiz/review/login_user.rb |
cm_quiz-0.0.1 | lib/cm_quiz/review/login_user.rb |