Sha256: 73afde2b9e732615ed6b2a65ef3729e10430ab4791c3e258430c01f567941cca

Contents?: true

Size: 886 Bytes

Versions: 17

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

describe JSON::JWK::Set do
  let(:jwk) { JSON::JWK.new public_key }
  let(:set) { JSON::JWK::Set.new jwk }

  describe '#content_type' do
    it do
      set.content_type.should == 'application/jwk-set+json'
    end
  end

  context 'when single JWK given' do
    subject { JSON::JWK::Set.new jwk }
    it { should == [jwk] }
  end

  context 'when multiple JWKs given' do
    subject { JSON::JWK::Set.new jwk, jwk }
    it { should == [jwk, jwk] }
  end

  context 'when an Array of JWKs given' do
    subject { JSON::JWK::Set.new [jwk, jwk] }
    it { should == [jwk, jwk] }
  end

  describe '#as_json' do
    it 'should become proper JWK set format' do
      json = set.as_json
      json.should include :keys
      json[:keys].should == [jwk]
    end
  end

  describe '#to_json' do
    it do
      expect { set.to_json }.not_to raise_error
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
json-jwt-1.1.0 spec/json/jwk/set_spec.rb
json-jwt-1.0.3 spec/json/jwk/set_spec.rb
json-jwt-1.0.2 spec/json/jwk/set_spec.rb
json-jwt-1.0.1 spec/json/jwk/set_spec.rb
json-jwt-1.0.0 spec/json/jwk/set_spec.rb
json-jwt-0.8.1 spec/json/jwk/set_spec.rb
json-jwt-0.8.0 spec/json/jwk/set_spec.rb
json-jwt-0.7.1 spec/json/jwk/set_spec.rb
json-jwt-0.7.0 spec/json/jwk/set_spec.rb
json-jwt-0.7.0.alpha2 spec/json/jwk/set_spec.rb
json-jwt-0.7.0.alpha spec/json/jwk/set_spec.rb
json-jwt-0.6.1 spec/json/jwk/set_spec.rb
json-jwt-0.6.0 spec/json/jwk/set_spec.rb
json-jwt-0.5.6 spec/json/jwk/set_spec.rb
json-jwt-0.5.5 spec/json/jwk/set_spec.rb
json-jwt-0.5.4 spec/json/jwk/set_spec.rb
json-jwt-0.5.3 spec/json/jwk/set_spec.rb