spec/oid_mapper_spec.rb in r509-1.0 vs spec/oid_mapper_spec.rb in r509-1.0.1

- old
+ new

@@ -15,9 +15,14 @@ expect(R509::OIDMapper.register('1.4.3.2.1.2.3.5.5.5.5.5', 'myOIDName')).to eq(true) subject_new = R509::Subject.new [['myOIDName', 'random_oid']] expect(subject_new['myOIDName']).to eq('random_oid') end + it "returns false when registering an oid that already exists" do + allow(OpenSSL::ASN1::ObjectId).to receive(:register).and_raise(OpenSSL::ASN1::ASN1Error) + expect(R509::OIDMapper.register('1.4.3.2.1.2.7.4.4.4.4', 'someOtherName')).to eq(false) + end + it "registers a batch of new oids" do expect { R509::Subject.new [['testOIDName', 'random_oid']] }.to raise_error(OpenSSL::X509::NameError, 'invalid field name') expect { R509::Subject.new [['anotherOIDName', 'second_random']] }.to raise_error(OpenSSL::X509::NameError, 'invalid field name') R509::OIDMapper.batch_register([ { :oid => '1.4.3.2.1.2.3.4.4.4.4', :short_name => 'testOIDName' },