Sha256: 2b86ae4544566b71bec7ff27186a641ee0ee63fa3fbf518ac302d140a4c8f9df
Contents?: true
Size: 1.38 KB
Versions: 11
Compression:
Stored size: 1.38 KB
Contents
require 'spec_helper' describe OpenIDConnect::ResponseObject do class OpenIDConnect::ResponseObject::SubClass < OpenIDConnect::ResponseObject attr_required :required attr_optional :optional end let(:klass) { OpenIDConnect::ResponseObject::SubClass } subject { klass.new attributes } context 'when required attributes are given' do context 'when optional attributes are given' do let :attributes do {:required => 'Required', :optional => 'Optional'} end its(:required) { should == 'Required' } its(:optional) { should == 'Optional' } end context 'otherwise' do let :attributes do {:required => 'Required'} end its(:required) { should == 'Required' } its(:optional) { should == nil } end end context 'otherwise' do context 'when optional attributes are given' do let :attributes do {:optional => 'Optional'} end it do expect { klass.new attributes }.should raise_error AttrRequired::AttrMissing end end context 'otherwise' do it do expect { klass.new }.should raise_error AttrRequired::AttrMissing end end end describe '#as_json' do let :attributes do {:required => 'Required', :optional => 'Optional'} end its(:as_json) do should == {:required => 'Required', :optional => 'Optional'} end end end
Version data entries
11 entries across 11 versions & 1 rubygems