Sha256: cd6e7f0ac7f6126702aeba5f5b855ba4d7e51bbe85559c980e9067884bb38753

Contents?: true

Size: 876 Bytes

Versions: 3

Compression:

Stored size: 876 Bytes

Contents

require 'helper'

describe Flipper::UI::Actions::Features do
  describe "GET /features" do
    before do
      flipper[:stats].enable
      flipper[:search].enable
      get "/features"
    end

    it "responds with success" do
      last_response.status.should be(200)
    end

    it "renders template" do
      last_response.body.should include("stats")
      last_response.body.should include("search")
    end
  end

  describe "POST /features" do
    before do
      post "/features",
        {"value" => "notifications_next", "authenticity_token" => "a"},
        "rack.session" => {:csrf => "a"}
    end

    it "adds feature" do
      flipper.features.map(&:key).should include("notifications_next")
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flipper-ui-0.2.0.beta5 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.2.0.beta4 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.2.0.beta3 spec/flipper/ui/actions/features_spec.rb