Class: CmQuiz::Review::LoginUser
- Inherits:
-
BaseReview
- Object
- BaseReview
- CmQuiz::Review::LoginUser
- Defined in:
- lib/cm_quiz/review/login_user.rb
Instance Attribute Summary
Attributes inherited from BaseReview
Instance Method Summary collapse
-
#initialize(project_api:) ⇒ LoginUser
constructor
A new instance of LoginUser.
- #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:) ⇒ LoginUser
Returns a new instance of LoginUser.
6 7 8 9 10 |
# File 'lib/cm_quiz/review/login_user.rb', line 6 def initialize(project_api:) @project_api = project_api @verb = :post @path = '/access-tokens' end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cm_quiz/review/login_user.rb', line 12 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 = (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.) end |