Sha256: 216af0d98595ecb751a1df9a73498bd8d5ffebaec0d5bacdc7497c2f0e2054f3

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

require 'spec_helper'

describe Rack::OAuth2::AccessToken::MAC::Verifier do
  let(:verifier) { Rack::OAuth2::AccessToken::MAC::Verifier.new(:algorithm => algorithm) }
  subject { verifier }

  context 'when "hmac-sha-1" is specified' do
    let(:algorithm) { 'hmac-sha-1' }
    its(:hash_generator) { should be_instance_of OpenSSL::Digest::SHA1 }
  end

  context 'when "hmac-sha-256" is specified' do
    let(:algorithm) { 'hmac-sha-256' }
    its(:hash_generator) { should be_instance_of OpenSSL::Digest::SHA256 }
  end

  context 'otherwise' do
    let(:algorithm) { 'invalid' }
    it do
      expect { verifier.send(:hash_generator) }.should raise_error(StandardError, 'Unsupported Algorithm')
    end
  end

  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-oauth2-0.14.6 spec/rack/oauth2/access_token/mac/verifier_spec.rb
rack-oauth2-0.14.5 spec/rack/oauth2/access_token/mac/verifier_spec.rb