spec/fridge/access_token_spec.rb in fridge-0.1.2 vs spec/fridge/access_token_spec.rb in fridge-0.2.0
- old
+ new
@@ -30,11 +30,11 @@
describe '#serialize' do
let(:options) do
{
id: SecureRandom.uuid,
- iss: 'https://auth.aptible.com',
+ issuer: 'https://auth.aptible.com',
subject: "https://auth.aptible.com/users/#{SecureRandom.uuid}",
scope: 'read',
expires_at: Time.now + 3600
}
end
@@ -82,9 +82,17 @@
it 'should complement #initialize' do
copy = described_class.new(subject.serialize)
expect(copy.subject).to eq subject.subject
expect(copy.expires_at.to_i).to eq subject.expires_at.to_i
expect(copy.scope).to eq subject.scope
+ end
+
+ it 'should include custom attributes' do
+ subject = described_class.new(options.merge(foo: 'bar'))
+ copy = described_class.new(subject.serialize)
+
+ expect(copy.attributes[:foo]).to eq 'bar'
+ expect(copy.foo).to eq 'bar'
end
it 'should raise an error if required attributes are missing' do
subject.subject = nil
expect { subject.serialize }.to raise_error Fridge::SerializationError