Sha256: 33a112231a7903db2cf313700e0d09b54d859bfd95c3d9efdda23558ebd1dee9
Contents?: true
Size: 823 Bytes
Versions: 4
Compression:
Stored size: 823 Bytes
Contents
require 'spec_helper' describe ActiveUrl do before(:each) do ActiveUrl::Config.stub!(:secret).and_return("secret") end describe "crypto" do it "should raise ArgumentError when no secret is set" do ActiveUrl::Config.stub!(:secret).and_return(nil) lambda { ActiveUrl::Crypto.encrypt("clear") }.should raise_error(ArgumentError) end it "should decode what it encodes" do ActiveUrl::Crypto.decrypt(ActiveUrl::Crypto.encrypt("clear")).should == "clear" end it "should always yield URL-safe output characters" do url_safe = /^[\w\-]*$/ (1..20).each do |n| clear = (0...8).inject("") { |string, n| string << rand(255).chr } # random string cipher = ActiveUrl::Crypto.encrypt(clear) cipher.should =~ url_safe end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
mholling-active_url-0.1.2 | spec/crypto_spec.rb |
mholling-active_url-0.1.3 | spec/crypto_spec.rb |
mholling-active_url-0.1.4 | spec/crypto_spec.rb |
active_url-0.1.4 | spec/crypto_spec.rb |