Sha256: fa666d445b0cdd6b830347b8644a12695bfb5b0c8c237b6e66cbe046563d4d50

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

require File.expand_path("../../../test_helper", __FILE__)

describe Flipflop::Strategies::DefaultStrategy do
  before do
    Flipflop::FeatureSet.current.replace do
      Flipflop.configure do
        feature :one, default: true
        feature :two
      end
    end
  end

  describe "with defaults" do
    subject do
      Flipflop::Strategies::DefaultStrategy.new.freeze
    end

    it "should have default name" do
      assert_equal "default", subject.name
    end

    it "should have title derived from name" do
      assert_equal "Default", subject.title
    end

    it "should have no default description" do
      assert_equal "Uses feature default status.", subject.description
    end

    it "should not be switchable" do
      assert_equal false, subject.switchable?
    end

    it "should have unique key" do
      assert_match /^\w+$/, subject.key
    end

    describe "with explicitly defaulted feature" do
      it "should have feature enabled" do
        assert_equal true, subject.enabled?(:one)
      end
    end

    describe "with implicitly defaulted feature" do
      it "should not have feature enabled" do
        assert_equal false, subject.enabled?(:two)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flipflop-2.8.0 test/unit/strategies/default_strategy_test.rb
flipflop-2.7.1 test/unit/strategies/default_strategy_test.rb
flipflop-2.7.0 test/unit/strategies/default_strategy_test.rb
flipflop-2.6.0 test/unit/strategies/default_strategy_test.rb
flipflop-2.5.0 test/unit/strategies/default_strategy_test.rb
flipflop-2.4.0 test/unit/strategies/default_strategy_test.rb
flipflop-2.3.1 test/unit/strategies/default_strategy_test.rb
flipflop-2.3.0 test/unit/strategies/default_strategy_test.rb