Sha256: ae63b143845ade0befdac6e70788451d5f79e5aae5b434535e13eb62dad4b7c1

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

require 'helper'

RSpec.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
      expect(last_response.status).to be(200)
    end

    it "renders template" do
      expect(last_response.body).to include("stats")
      expect(last_response.body).to 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
      expect(flipper.features.map(&:key)).to include("notifications_next")
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flipper-ui-0.7.2 spec/flipper/ui/actions/features_spec.rb