Sha256: 142a5fa32144fa7e2176b2f197e123574c653c4ce0cd9f6ee6aa41071d9e658f

Contents?: true

Size: 516 Bytes

Versions: 4

Compression:

Stored size: 516 Bytes

Contents

require 'bluekai/request'
RSpec.shared_context 'signature_mock' do
  before :each do
    allow(OpenSSL::HMAC)
      .to receive(:digest)
      .and_wrap_original do |method, digest, api_private_key, string_to_sign|
      hash = Digest::SHA256.hexdigest(string_to_sign)
      file = "spec/fixtures/signatures/#{hash}"
      next File.read(file) if File.exist?(file)
      result = method.call(digest, api_private_key, string_to_sign)
      File.open(file, 'w+') { |f| f.write(result) }
      result
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bluekai-0.0.6 spec/support/signature_mock.rb
bluekai-0.0.5 spec/support/signature_mock.rb
bluekai-0.0.4 spec/support/signature_mock.rb
bluekai-0.0.3 spec/support/signature_mock.rb