Sha256: f07f5d6ccbd09eb08017e6df8421ff4a64854af7506ac707312aaa0780127625

Contents?: true

Size: 1.58 KB

Versions: 8

Compression:

Stored size: 1.58 KB

Contents

require 'helper'

describe Flipper::UI::Actions::Feature do
  describe "DELETE /features/:feature" do
    before do
      flipper.enable :search
      delete "/features/search",
        {"authenticity_token" => "a"},
        "rack.session" => {:csrf => "a"}
    end

    it "removes feature" do
      flipper.features.map(&:key).should_not include("search")
    end

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

  describe "POST /features/:feature with _method=DELETE" do
    before do
      flipper.enable :search
      post "/features/search",
        {"_method" => "DELETE", "authenticity_token" => "a"},
        "rack.session" => {:csrf => "a"}
    end

    it "removes feature" do
      flipper.features.map(&:key).should_not include("search")
    end

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

  describe "GET /features/:feature" do
    before do
      get "/features/search"
    end

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

    it "renders template" do
      last_response.body.should include("search")
      last_response.body.should include("Enable")
      last_response.body.should include("Disable")
      last_response.body.should include("Actors")
      last_response.body.should include("Groups")
      last_response.body.should include("Percentage of Time")
      last_response.body.should include("Percentage of Actors")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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