Class: CmQuiz::Review::GetUserInfo

Inherits:
BaseReview show all
Defined in:
lib/cm_quiz/review/get_user_info.rb

Instance Attribute Summary

Attributes inherited from BaseReview

#options, #path, #verb

Instance Method Summary collapse

Methods inherited from BaseReview

#build_test_result, #perform, #test_request

Methods included from CmQuiz::ReviewHelper

#be, #be_nil, #be_within, #eq, #expect

Constructor Details

#initialize(project_api:) ⇒ GetUserInfo

Returns a new instance of GetUserInfo.



6
7
8
9
10
# File 'lib/cm_quiz/review/get_user_info.rb', line 6

def initialize(project_api:)
  @project_api = project_api
  @verb = :get
  @path = '/me'
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cm_quiz/review/get_user_info.rb', line 12

def run
  name = "codementor-test-#{SecureRandom.hex(5)}"
  email = "#{name}@codementor.io"
  password = "pAssw0rd!"
  jwt, _refresh_token = Factory::User.new({
    project_api: @project_api,
    name: name,
    email: email,
    password: password
  }).create

  res = (jwt: jwt)
  payload = JSON.parse(res.body)

  expect(payload['email']).to eq(email)
  expect(payload['name']).to eq(name)
end