Sha256: dbdbd353a37d3b8541ceb4f5c1de6f58dae96804b921516c7f0e746e466eb61e

Contents?: true

Size: 932 Bytes

Versions: 13

Compression:

Stored size: 932 Bytes

Contents

# frozen_string_literal: true

describe CoinsPaid::API::Signature, '#check!' do
  let(:key) { 'publickey' }
  let(:signature) { 'd2b3292793cb1f527dab4c9d8128356a0df7635aa1796a4d45276646ce914dcf29bb9244aed750a3a5b7d26aabb44ba560b05ed1233168107bed4ca684522508' }
  let(:request_body) { { key: :value }.to_json }
  subject(:check) { described_class.check!(key: key, signature: signature, request_body: request_body) }

  context 'when key and signature are valid' do
    it { is_expected.to be_truthy }
  end

  context 'when key is invalid' do
    let(:key) { 'invalidkey' }

    it 'raises invalid signature error' do
      expect { check }.to raise_error(CoinsPaid::API::InvalidSignatureError)
    end
  end

  context 'when signature is invalid' do
    let(:signature) { 'invalidsignature' }

    it 'raises invalid signature error' do
      expect { check }.to raise_error(CoinsPaid::API::InvalidSignatureError)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
coins_paid_api-2.2.0 spec/check_signature_spec.rb
coins_paid_api-2.1.0 spec/check_signature_spec.rb
coins_paid_api-2.0.0 spec/check_signature_spec.rb
coins_paid_api-1.3.0 spec/check_signature_spec.rb
coins_paid_api-1.2.0 spec/check_signature_spec.rb
coins_paid_api-1.1.0 spec/check_signature_spec.rb
coins_paid_api-1.0.7 spec/check_signature_spec.rb
coins_paid_api-1.0.6 spec/check_signature_spec.rb
coins_paid_api-1.0.5 spec/check_signature_spec.rb
coins_paid_api-1.0.4 spec/check_signature_spec.rb
coins_paid_api-1.0.3 spec/check_signature_spec.rb
coins_paid_api-1.0.2 spec/check_signature_spec.rb
coins_paid_api-1.0.1 spec/check_signature_spec.rb