Sha256: 7b3179a5b4852b9001d45cc951f58fe3d1af2fea9bece18ead6ca9eb8f2656b5
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' require 'crypt' describe HipChatSecrets::Crypt do # The subject is static methods / don't create an object subject { HipChatSecrets::Crypt } before do subject.secret = 'not the real secret' end it "tests with a phoney secret" do subject.secret_str.should eq 'not the real secret' end it "xor of string => string" do subject.xor('hello').should be_a_kind_of String end it "xor of xor of string => string" do result = subject.xor(subject.xor 'hello') result.should be_a_kind_of String result.should eq 'hello' end it "decodes secrets" do subject.decode('Hg4aRBUb').should eq 'pandas' end it "encodes secrets" do subject.encode('pandas').should eq 'Hg4aRBUb' end it "is symmetric" do subject.decode(subject.encode 'pandas').should eq 'pandas' end it "is symmetric even with long strings" do str = 'Hello, I noticed that you are reading my code. Enjoy and happy hacking!' subject.decode(subject.encode str*20).should eq str*20 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hipchat-secrets-0.9.1 | spec/lib/crypt_spec.rb |