Sha256: f98d009bba99eaa041163c945dad2ba7e4ed0b7726997d3d8393d528f34ab2dd

Contents?: true

Size: 733 Bytes

Versions: 7

Compression:

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

7 entries across 7 versions & 1 rubygems

Version Path
flipper-ui-0.9.1 spec/flipper/ui/actions/gate_spec.rb
flipper-ui-0.9.0 spec/flipper/ui/actions/gate_spec.rb
flipper-ui-0.9.0.beta1 spec/flipper/ui/actions/gate_spec.rb
flipper-ui-0.8.0 spec/flipper/ui/actions/gate_spec.rb
flipper-ui-0.7.5 spec/flipper/ui/actions/gate_spec.rb
flipper-ui-0.7.4 spec/flipper/ui/actions/gate_spec.rb
flipper-ui-0.7.3 spec/flipper/ui/actions/gate_spec.rb