mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Add feature toggle for API v1 use
Dev, test and staging need to activate the feature toggle now before it's accessible.
This commit is contained in:
@@ -87,13 +87,11 @@ Openfoodnetwork::Application.routes.draw do
|
||||
constraints: lambda { |_| Flipper.enabled?(:api_reports) }
|
||||
end
|
||||
|
||||
unless Rails.env.production?
|
||||
namespace :v1 do
|
||||
resources :customers
|
||||
namespace :v1, constraints: ->(request) { Flipper.enabled?(:api_v1, request.env["warden"].user) } do
|
||||
resources :customers
|
||||
|
||||
resources :enterprises do
|
||||
resources :customers, only: :index
|
||||
end
|
||||
resources :enterprises do
|
||||
resources :customers, only: :index
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@ describe "Customers", type: :request do
|
||||
let!(:customer2) { create(:customer, enterprise: enterprise1) }
|
||||
let!(:customer3) { create(:customer, enterprise: enterprise2) }
|
||||
|
||||
before { login_as enterprise1.owner }
|
||||
before do
|
||||
Flipper.enable(:api_v1)
|
||||
login_as enterprise1.owner
|
||||
end
|
||||
|
||||
path "/api/v1/customers" do
|
||||
get "List customers" do
|
||||
|
||||
Reference in New Issue
Block a user