Skip to content

Commit

Permalink
Merge 9641382 into 9205a58
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed Sep 14, 2013
2 parents 9205a58 + 9641382 commit 7f38852
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/rbnacl/keys/private_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@
let(:key_bytes) { subject.to_bytes }
let(:other_key) { described_class.new(bobpk) }
end

include_examples "serializable"
end
2 changes: 2 additions & 0 deletions spec/rbnacl/keys/public_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@
let(:key_bytes) { subject.to_bytes }
let(:other_key) { described_class.new(alicepk.succ) }
end

include_examples "serializable"
end
2 changes: 2 additions & 0 deletions spec/rbnacl/keys/signing_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
let(:key) { described_class.new(key_bytes) }
let(:other_key) { described_class.new("B"*32) }
end

include_examples "serializable"
end
2 changes: 2 additions & 0 deletions spec/rbnacl/keys/verify_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@
let(:key) { described_class.new(verify_key) }
let(:other_key) { described_class.new("B"*32) }
end

include_examples "serializable"
end
2 changes: 2 additions & 0 deletions spec/rbnacl/point_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
it "serializes to bytes" do
subject.to_bytes.should eq bob_public
end

include_examples "serializable"
end
17 changes: 17 additions & 0 deletions spec/shared/serializable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# encoding: binary

shared_examples "serializable" do
context "serialization" do
it "supports #to_s" do
expect(subject.to_s).to be_a String
end

it "supports #to_str" do
expect(subject.to_str).to be_a String
end

it "supports #inspect" do
expect(subject.inspect).to be_a String
end
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require 'shared/box'
require 'shared/authenticator'
require 'shared/key_equality'
require 'shared/serializable'

def vector(name)
[RbNaCl::TestVectors[name]].pack("H*")
Expand Down

0 comments on commit 7f38852

Please sign in to comment.