Sha256: e7272349f3b7ce441fd4089a3440c4739052c2e0b5f0dd28a49627b8fcdc0906
Contents?: true
Size: 827 Bytes
Versions: 17
Compression:
Stored size: 827 Bytes
Contents
require "spec_helper" describe Shamu::Features::ToggleCodec do let( :codec ) { Shamu::Features::ToggleCodec.new( SecureRandom.random_bytes( 64 ) ) } describe "#pack" do subject { codec.pack( "buy_now" => true, "suggestions" => false ) } it { is_expected.to match /,/ } it { is_expected.to match /[^!]buy_now/ } it { is_expected.to match /!suggestions/ } end describe "#unpack" do let( :packed ) { codec.pack( "buy_now" => true, "suggestions" => false ) } subject { codec.unpack( packed ) } its(["buy_now"]) { is_expected.to eq true } its(["suggestions"]) { is_expected.to eq false } its(["not/set"]) { is_expected.to be_nil } it "handles an empty feature hash" do packed = codec.pack( {} ) expect( codec.unpack( packed ) ).to eq( {} ) end end end
Version data entries
17 entries across 17 versions & 1 rubygems