Sha256: c721ef1dcaf27d8d5268dfe7440964717b396144246753358171e7ee2f250712

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require 'helper'

RSpec.describe Flipper::UI::Actions::Gate do
  describe "POST /features/:feature/non-existent-gate" do
    before do
      post "/features/search/non-existent-gate",
        {"authenticity_token" => "a"},
        "rack.session" => {:csrf => "a"}
    end

    it "responds with redirect" do
      expect(last_response.status).to be(302)
    end

    it "escapes error message" do
      expect(last_response.headers["Location"]).to eq("/features/search?error=%22non-existent-gate%22+gate+does+not+exist+therefore+it+cannot+be+updated.")
    end

    it "renders error in template" do
      follow_redirect!
      expect(last_response.body).to match(/non-existent-gate.*gate does not exist/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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