Class: CmQuiz::Review::UpdateIdea
- Inherits:
-
BaseReview
- Object
- BaseReview
- CmQuiz::Review::UpdateIdea
- Defined in:
- lib/cm_quiz/review/update_idea.rb
Instance Attribute Summary
Attributes inherited from BaseReview
Instance Method Summary collapse
-
#initialize(project_api:) ⇒ UpdateIdea
constructor
A new instance of UpdateIdea.
- #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:) ⇒ UpdateIdea
Returns a new instance of UpdateIdea.
4 5 6 7 8 |
# File 'lib/cm_quiz/review/update_idea.rb', line 4 def initialize(project_api:) @project_api = project_api @verb = :put @path = '/ideas/:idea_id' 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 29 30 31 32 33 34 35 |
# File 'lib/cm_quiz/review/update_idea.rb', line 10 def run jwt, _ = Factory::User.new({ project_api: @project_api }).create idea_payload = Factory::Idea.new({ project_api: @project_api, jwt: jwt }).create idea_id = idea_payload['id'] res = send_update_idea_request({ jwt: jwt, idea_id: idea_id, content: 'test-new-content', impact: 6, ease: 7, confidence: 8 }) payload = JSON.parse(res.body) expect(payload['content']).to eq('test-new-content') expect(payload['impact']).to eq(6) expect(payload['ease']).to eq(7) expect(payload['confidence']).to eq(8) expect(payload['average_score']).to eq(7.0) end |