spec/key_spec.rb in slosilo-0.4.1 vs spec/key_spec.rb in slosilo-1.0.0
- old
+ new
@@ -5,10 +5,11 @@
subject { key }
its(:to_der) { should == rsa.to_der }
its(:to_s) { should == rsa.public_key.to_pem }
its(:fingerprint) { should == key_fingerprint }
+ it { should be_private }
context "with identical key" do
let(:other) { Slosilo::Key.new rsa.to_der }
it "is equal" do
subject.should == other
@@ -33,9 +34,19 @@
subject.eql?(other).should_not be_true
end
it "has different hash" do
subject.hash.should_not == other.hash
+ end
+ end
+
+ describe '#public' do
+ it "returns a key with just the public half" do
+ pkey = subject.public
+ expect(pkey).to be_a(Slosilo::Key)
+ expect(pkey).to_not be_private
+ expect(pkey.key).to_not be_private
+ expect(pkey.to_der).to eq(rsa.public_key.to_der)
end
end
let(:plaintext) { 'quick brown fox jumped over the lazy dog' }
describe '#encrypt' do