require 'minitest/spec' require 'minitest/mock' require 'minitest/autorun' require 'webmock/minitest' require 'crp' FIXTURES_PATH = File.expand_path("#{File.dirname(__FILE__)}/fixtures") def valid_review_body @valid_review_body ||= File.read(File.join(FIXTURES_PATH, 'valid_review.json')) end def valid_callback_review_body @valid_callback_review_body ||= File.read(File.join(FIXTURES_PATH, 'valid_callback_review.txt')).chomp end def stub_new_review_request request = { :headers => {'Accept' => '*/*', 'User-Agent' => 'Ruby'} } response = { :status => 200, :body => {}, :headers => {} } stub_request(:get, new_review_url).with(request).to_return(response) end def new_review_url "https://crp.example.com/api/v1/Review/newReview?client=client&arguments=%5B%7B%22reviewType%22%3A1%2C%22reviewContent%22%3A%22I+am+a+very+cheerful+and+good-humored.%22%2C%22internalReviewId%22%3A%22ABCDE12345%22%2C%22gender%22%3A1%2C%22username%22%3A%22starryheart28%22%2C%22age%22%3A28%7D%5D&signature=77ce496ea7f78ae7b6deab0d492b265a81276cb6" end