Sha256: bfd97799882ecd0f91ea5371d010ddd783d84949f3eda8c7cbc9abc55ab89f0c

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

require 'helper'

describe Flipper::UI::Actions::BooleanGate do
  describe "POST /features/:feature/boolean" do
    context "with enable" do
      before do
        flipper.disable :search
        post "features/search/boolean",
          {"action" => "Enable", "authenticity_token" => "a"},
          "rack.session" => {:csrf => "a"}
      end

      it "enables the feature" do
        flipper.enabled?(:search).should be(true)
      end

      it "redirects back to feature" do
        last_response.status.should be(302)
        last_response.headers["Location"].should eq("/features/search")
      end
    end

    context "with disable" do
      before do
        flipper.enable :search
        post "features/search/boolean",
          {"action" => "Disable", "authenticity_token" => "a"},
          "rack.session" => {:csrf => "a"}
      end

      it "disables the feature" do
        flipper.enabled?(:search).should be(false)
      end

      it "redirects back to feature" do
        last_response.status.should be(302)
        last_response.headers["Location"].should eq("/features/search")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flipper-ui-0.7.1 spec/flipper/ui/actions/boolean_gate_spec.rb
flipper-ui-0.7.0 spec/flipper/ui/actions/boolean_gate_spec.rb
flipper-ui-0.7.0.beta6 spec/flipper/ui/actions/boolean_gate_spec.rb
flipper-ui-0.7.0.beta5 spec/flipper/ui/actions/boolean_gate_spec.rb
flipper-ui-0.7.0.beta4 spec/flipper/ui/actions/boolean_gate_spec.rb
flipper-ui-0.2.0.beta5 spec/flipper/ui/actions/boolean_gate_spec.rb
flipper-ui-0.2.0.beta4 spec/flipper/ui/actions/boolean_gate_spec.rb
flipper-ui-0.2.0.beta3 spec/flipper/ui/actions/boolean_gate_spec.rb