Sha256: 70baf9bfd1c47cdad2b27de9e58c1fb8739a136e41851d4f60dd7bd59ed46c05
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
module CmQuiz module Review class DeleteIdea < BaseReview def initialize(project_api:) @project_api = project_api @verb = :delete @path = '/ideas/:idea_id' end 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'] send_delete_idea_request(jwt: jwt, idea_id: idea_id) res = send_get_ideas_request(jwt: jwt) res_hash = JSON.parse(res.body) expect(res_hash.size).to eq(0) end private def send_delete_idea_request(jwt:, idea_id:) @options = { headers: { 'x-access-token' => jwt } } @path = "/ideas/#{idea_id}" @project_api.request(:delete, @path, @options) end def send_get_ideas_request(jwt:) options = { headers: { 'x-access-token' => jwt } } @project_api.request(:get, "/ideas", options) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems