Sha256: 900e7ce1074880056ae8081be22b46c9fb28f485e7dd9ad833af6dcb82e866d2

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

require 'helper'

RSpec.describe Flipper::UI::Actions::AddFeature do
  describe 'GET /features/new with feature_creation_enabled set to true' do
    before do
      @original_feature_creation_enabled = Flipper::UI.feature_creation_enabled
      Flipper::UI.feature_creation_enabled = true
      get '/features/new'
    end

    after do
      Flipper::UI.feature_creation_enabled = @original_feature_creation_enabled
    end

    it 'responds with success' do
      expect(last_response.status).to be(200)
    end

    it 'renders template' do
      expect(last_response.body).to include('<form action="/features" method="post">')
    end
  end

  describe 'GET /features/new with feature_creation_enabled set to false' do
    before do
      @original_feature_creation_enabled = Flipper::UI.feature_creation_enabled
      Flipper::UI.feature_creation_enabled = false
      get '/features/new'
    end

    after do
      Flipper::UI.feature_creation_enabled = @original_feature_creation_enabled
    end

    it 'returns 403' do
      expect(last_response.status).to be(403)
    end

    it 'renders feature creation disabled template' do
      expect(last_response.body).to include('Feature creation is disabled.')
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
flipper-ui-0.12.2 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.12.1 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.12.0 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.rc1 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta9 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta8 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta7 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta6 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta5 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta4 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta3 spec/flipper/ui/actions/add_feature_spec.rb
flipper-ui-0.11.0.beta1 spec/flipper/ui/actions/add_feature_spec.rb