Sha256: c72a8921d2ceafa7ef6d4fafec47b9635c2fe77e46eb137c3bdda5471754b89b

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

RSpec.shared_context 'signature_mock' do
  before :each do
    allow(subject).to receive(:sign).and_wrap_original do |method, http_method, path, query, body|
      string_to_sign = http_method + path + query.to_s + body.to_s
      hash = Digest::SHA256.hexdigest(string_to_sign)
      file = "spec/fixtures/signatures/#{hash}"
      next File.read(file) if File.exist?(file)
      result = method.call(http_method, path, query, body)
      File.open(file, 'w+') { |f| f.write(result) }
      result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bluekai-0.0.2 spec/support/signature_mock.rb