Sha256: 2ef985f7f5082007d117fdbf8aa64c879415a22152b7b2b839860de1f8ef2c5d
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require 'test_helper' class TrailTest < ActiveSupport::TestCase setup do Gretel::Trail.secret = "128107d341e912db791d98bbe874a8250f784b0a0b4dbc5d5032c0fc1ca7bda9c6ece667bd18d23736ee833ea79384176faeb54d2e0d21012898dde78631cdf1" @links = [ ["root", "Home", "/"], ["store", "Store", "/store"], ["search", "Search", "/store/search?q=test"] ] end test "defaults" do assert_equal :trail, Gretel::Trail.trail_param end test "encoding" do assert_equal "122.5Th13fvkg_W1sicm9vdCIsIkhvbWUiLCIvIl0sWyJzdG9yZSIsIlN0b3JlIiwiL3N0b3JlIl0sWyJzZWFyY2giLCJTZWFyY2giLCIvc3RvcmUvc2VhcmNoP3E9dGVzdCJdXQ==", Gretel::Trail.encode(@links.map { |key, text, url| Gretel::Link.new(key, text, url) }) end test "decoding" do assert_equal @links, Gretel::Trail.decode("122.5Th13fvkg_W1sicm9vdCIsIkhvbWUiLCIvIl0sWyJzdG9yZSIsIlN0b3JlIiwiL3N0b3JlIl0sWyJzZWFyY2giLCJTZWFyY2giLCIvc3RvcmUvc2VhcmNoP3E9dGVzdCJdXQ==").map { |link| [link.key, link.text, link.url] } end test "invalid trail" do assert_equal [], Gretel::Trail.decode("122.5Th13fvkg_X1sicm9vdCIsIkhvbWUiLCIvIl0sWyJzdG9yZSIsIlN0b3JlIiwiL3N0b3JlIl0sWyJzZWFyY2giLCJTZWFyY2giLCIvc3RvcmUvc2VhcmNoP3E9dGVzdCJdXQ==") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gretel-3.0.0.beta1 | test/trail_test.rb |
gretel-2.2.0.rc2 | test/trail_test.rb |