spec/helpers/signature_spec.rb in hubspot-api-client-17.0.0.pre.beta.3 vs spec/helpers/signature_spec.rb in hubspot-api-client-17.0.0.pre.beta.4

- old
+ new

@@ -1,7 +1,8 @@ require 'date' require_relative "../../lib/hubspot/helpers/signature" +require_relative "../../lib/hubspot/exceptions" TEST_DATA = { :client_secret=> "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", :request_body=> "{'example_field':'example_value'}", :url=> "https://www.example.com/webhook_uri", @@ -47,11 +48,11 @@ it "should raise exception for wrong signature version" do expect{ signature.get_signature( client_secret: TEST_DATA[:client_secret], request_body: TEST_DATA[:request_body], signature_version: "wrong_signature_version" - ) }.to raise_error(StandardError) + ) }.to raise_error(Hubspot::InvalidSignatureVersionError) end end describe "Hubspot::Helpers::Signature.is_valid" do @@ -100,18 +101,18 @@ signature: TEST_DATA[:v3_hash], client_secret: TEST_DATA[:client_secret], request_body: TEST_DATA[:request_body], http_uri: TEST_DATA[:http_uri], signature_version: "v3" - ) }.to raise_error(StandardError) + ) }.to raise_error(Hubspot::InvalidSignatureTimestampError) end it "should raise exception if :signature_version=>v3 and :timestamp=>wrong_timestamp" do expect { signature.is_valid( signature: TEST_DATA[:v3_hash], client_secret: TEST_DATA[:client_secret], request_body: TEST_DATA[:request_body], http_uri: TEST_DATA[:http_uri], timestamp: "wrong_timestamp", signature_version: "v3" - ) }.to raise_error(StandardError) + ) }.to raise_error(Hubspot::InvalidSignatureTimestampError) end end