Class: CmQuiz::Review::SignUpUser
- Inherits:
-
BaseReview
- Object
- BaseReview
- CmQuiz::Review::SignUpUser
- Defined in:
- lib/cm_quiz/review/sign_up_user.rb
Instance Attribute Summary
Attributes inherited from BaseReview
Instance Method Summary collapse
-
#initialize(project_api:) ⇒ SignUpUser
constructor
A new instance of SignUpUser.
- #run ⇒ Object
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:) ⇒ SignUpUser
Returns a new instance of SignUpUser.
6 7 8 9 10 |
# File 'lib/cm_quiz/review/sign_up_user.rb', line 6 def initialize(project_api:) @project_api = project_api @verb = :post @path = '/users' end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cm_quiz/review/sign_up_user.rb', line 12 def run name = "codementor-test-#{SecureRandom.hex(5)}" email = "#{name}@codementor.io" password = "pAssw0rd!" res = send_sign_up_user_request(email: email, name: name, password: password) 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' build_test_result(self.class) rescue RSpec::Expectations::ExpectationNotMetError => e build_test_result(self.class, false, e.) rescue => e build_test_result(self.class, false, e.) end |