Class: CmQuiz::Review::CreateIdea
- Inherits:
-
BaseReview
- Object
- BaseReview
- CmQuiz::Review::CreateIdea
- Defined in:
- lib/cm_quiz/review/create_idea.rb
Instance Attribute Summary
Attributes inherited from BaseReview
Instance Method Summary collapse
-
#initialize(project_api:) ⇒ CreateIdea
constructor
A new instance of CreateIdea.
- #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:) ⇒ CreateIdea
Returns a new instance of CreateIdea.
4 5 6 7 8 |
# File 'lib/cm_quiz/review/create_idea.rb', line 4 def initialize(project_api:) @project_api = project_api @verb = :post @path = '/ideas' end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cm_quiz/review/create_idea.rb', line 10 def run jwt, _ = Factory::User.new({ project_api: @project_api }).create res = send_create_idea_request({ jwt: jwt, content: 'test-content', impact: 7, ease: 8, confidence: 9 }) payload = JSON.parse(res.body) expect(payload['impact']).to eq(7), "expect impact equal 7, but got #{payload['impact']}" expect(payload['ease']).to eq(8), "expect ease equal 8, but got #{payload['ease']}" expect(payload['confidence']).to eq(9), "expect confidence equal 9, but got #{payload['confidence']}" expect(payload['average_score']).to eq(8.0), "expect average_score equal 8, but got #{payload['average_score']}" end |