Sha256: 32ad96242827e258bcebcf6ff00bcc98045d48df1eee09c2691c518ccd151c7f

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 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_token" => "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

3 entries across 3 versions & 1 rubygems

Version Path
flipper-ui-0.7.5 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.7.4 spec/flipper/ui/actions/features_spec.rb
flipper-ui-0.7.3 spec/flipper/ui/actions/features_spec.rb