Sha256: 562793804cedb5e0bd3b9f5548987b512573b30311ecb0b41555073d939a8a34

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

require "spec_helper"


describe Shamu::Features::Conditions::Env do
  let( :context ) { double( Shamu::Features::Context ) }
  let( :toggle )  { double( Shamu::Features::Toggle ) }

  it "matches on presence of truthy variable" do
    condition = scorpion.new Shamu::Features::Conditions::Env, "CANARY", toggle

    expect( context ).to receive( :env ).with( "CANARY" ).and_return "true"
    expect( condition.match?( context ) ).to be_truthy
  end

  it "matches on variable value" do
    condition = scorpion.new Shamu::Features::Conditions::Env, { "CANARY" => "example" }, toggle

    expect( context ).to receive( :env ).with( "CANARY" ).and_return "example"
    expect( condition.match?( context ) ).to be_truthy
  end

  it "doesn't match with invalid variable" do
    condition = scorpion.new Shamu::Features::Conditions::Env, "MISSING_ENV_VARIABLE_NAME", toggle

    expect( context ).to receive( :env ).with( "MISSING_ENV_VARIABLE_NAME" ).and_return nil
    expect( condition.match?( context ) ).to be_falsy
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

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