test/pagarme/resources/postback_test.rb in pagarme-2.1.2 vs test/pagarme/resources/postback_test.rb in pagarme-2.1.3

- old
+ new

@@ -1,9 +1,9 @@ require_relative '../../test_helper' module PagarMe - class TransactionTest < Test::Unit::TestCase + class TransactionTest < PagarMeTestCase should 'be valid when has valid signature' do fixed_api_key do postback = PagarMe::Postback.new postback_response_params assert postback.valid? end @@ -13,12 +13,14 @@ postback = PagarMe::Postback.new postback_response_params(signature: 'sha1=invalid signature') assert !postback.valid? end should 'validate signature' do - params = postback_response_params - assert PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature]) - assert !PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature][4..-1]) - assert !PagarMe::Postback.valid_request_signature?(params[:payload], 'invalid signature') + fixed_api_key do + params = postback_response_params + assert PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature]) + assert !PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature][4..-1]) + assert !PagarMe::Postback.valid_request_signature?(params[:payload], 'invalid signature') + end end end end