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

Version Path
shamu-0.0.24 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.21 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.20 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.19 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.18 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.17 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.15 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.14 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.13 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.11 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.9 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.8 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.7 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.5 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.4 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.3 spec/lib/shamu/features/toggle_codec_spec.rb
shamu-0.0.2 spec/lib/shamu/features/toggle_codec_spec.rb