Sha256: dd7cb0d951208a154dea39267b6c27327ea0a69e5a4e7b7413b1926dd45ec643

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

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

describe Flipflop do
  describe "without engine" do
    before do
      @app = TestApp.new
    end

    after do
      @app.unload!
    end

    subject do
      @app
    end

    describe "middleware" do
      it "should include cache middleware" do
        middlewares = Rails.application.middleware.map(&:klass)
        assert_includes middlewares, Flipflop::FeatureCache::Middleware
      end
    end

    describe "module" do
      before do
        Flipflop::FeatureSet.current.instance_variable_set(:@features, {})
        Module.new do
          extend Flipflop::Configurable
          feature :world_domination
        end
      end

      it "should allow querying for app features" do
        assert_equal false, Flipflop.world_domination?
      end
    end
  end

  describe "with engine" do
    before do
      @app = TestApp.new([
        TestFeaturesGenerator,
        TestEngineGenerator,
      ])
    end

    after do
      @app.unload!
    end

    subject do
      @app
    end

    describe "module" do
      it "should allow querying for app features" do
        assert_equal false, Flipflop.application_feature?
      end

      it "should allow querying for engine features" do
        assert_equal false, Flipflop.engine_feature?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flipflop-2.3.1 test/integration/app_test.rb
flipflop-2.3.0 test/integration/app_test.rb