spec/flipper/ui/actions/feature_spec.rb in flipper-ui-0.10.2 vs spec/flipper/ui/actions/feature_spec.rb in flipper-ui-0.11.0.beta1

- old
+ new

@@ -1,74 +1,74 @@ require 'helper' RSpec.describe Flipper::UI::Actions::Feature do - let(:token) { + let(:token) do if Rack::Protection::AuthenticityToken.respond_to?(:random_token) Rack::Protection::AuthenticityToken.random_token else - "a" + 'a' end - } - let(:session) { + end + let(:session) do if Rack::Protection::AuthenticityToken.respond_to?(:random_token) - {:csrf => token} + { csrf: token } else - {"_csrf_token" => token} + { '_csrf_token' => token } end - } + end - describe "DELETE /features/:feature" do + describe 'DELETE /features/:feature' do before do flipper.enable :search - delete "/features/search", - {"authenticity_token" => token}, - "rack.session" => session + delete '/features/search', + { 'authenticity_token' => token }, + 'rack.session' => session end - it "removes feature" do - expect(flipper.features.map(&:key)).not_to include("search") + it 'removes feature' do + expect(flipper.features.map(&:key)).not_to include('search') end - it "redirects to features" do + it 'redirects to features' do expect(last_response.status).to be(302) - expect(last_response.headers["Location"]).to eq("/features") + expect(last_response.headers['Location']).to eq('/features') end end - describe "POST /features/:feature with _method=DELETE" do + describe 'POST /features/:feature with _method=DELETE' do before do flipper.enable :search - post "/features/search", - {"_method" => "DELETE", "authenticity_token" => token}, - "rack.session" => session + post '/features/search', + { '_method' => 'DELETE', 'authenticity_token' => token }, + 'rack.session' => session end - it "removes feature" do - expect(flipper.features.map(&:key)).not_to include("search") + it 'removes feature' do + expect(flipper.features.map(&:key)).not_to include('search') end - it "redirects to features" do + it 'redirects to features' do expect(last_response.status).to be(302) - expect(last_response.headers["Location"]).to eq("/features") + expect(last_response.headers['Location']).to eq('/features') end end - describe "GET /features/:feature" do + describe 'GET /features/:feature' do before do - get "/features/search" + get '/features/search' end - it "responds with success" do + it 'responds with success' do expect(last_response.status).to be(200) end - it "renders template" do - expect(last_response.body).to include("search") - expect(last_response.body).to include("Enable") - expect(last_response.body).to include("Disable") - expect(last_response.body).to include("Actors") - expect(last_response.body).to include("Groups") - expect(last_response.body).to include("Percentage of Time") - expect(last_response.body).to include("Percentage of Actors") + it 'renders template' do + expect(last_response.body).to include('search') + expect(last_response.body).to include('Enable') + expect(last_response.body).to include('Disable') + expect(last_response.body).to include('Actors') + expect(last_response.body).to include('Groups') + expect(last_response.body).to include('Percentage of Time') + expect(last_response.body).to include('Percentage of Actors') end end end