Sha256: 8ad5b505a609453dfeb4a9f77b0434b034cee0590fe497fea73650297c8a20f0

Contents?: true

Size: 894 Bytes

Versions: 5

Compression:

Stored size: 894 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 feature" do
      last_response.status.should be(302)
      last_response.headers["Location"].should eq("/features/notifications_next")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flipper-ui-0.7.1 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.7.0 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.7.0.beta6 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.7.0.beta5 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.7.0.beta4 spec/flipper/ui/actions/features_spec.rb