adds feature flag for admin/budgets management

This commit is contained in:
Juanjo Bazán
2016-09-07 15:13:39 +02:00
parent f8a5f02cc9
commit 2d56415048
5 changed files with 18 additions and 0 deletions

View File

@@ -1,4 +1,6 @@
class Admin::BudgetHeadingsController < Admin::BaseController class Admin::BudgetHeadingsController < Admin::BaseController
include FeatureFlags
feature_flag :budgets
def create def create
@budget = Budget.find params[:budget_id] @budget = Budget.find params[:budget_id]

View File

@@ -1,4 +1,6 @@
class Admin::BudgetInvestmentsController < Admin::BaseController class Admin::BudgetInvestmentsController < Admin::BaseController
include FeatureFlags
feature_flag :budgets
before_action :load_budget before_action :load_budget
before_action :load_investment, only: [:show, :edit, :update] before_action :load_investment, only: [:show, :edit, :update]

View File

@@ -1,4 +1,6 @@
class Admin::BudgetsController < Admin::BaseController class Admin::BudgetsController < Admin::BaseController
include FeatureFlags
feature_flag :budgets
has_filters %w{open finished}, only: :index has_filters %w{open finished}, only: :index

View File

@@ -1,4 +1,7 @@
class BudgetsController < ApplicationController class BudgetsController < ApplicationController
include FeatureFlags
feature_flag :budgets
load_and_authorize_resource load_and_authorize_resource
respond_to :html, :js respond_to :html, :js

View File

@@ -9,6 +9,15 @@ feature 'Admin budget investments' do
@budget = create(:budget) @budget = create(:budget)
end end
context "Feature flag" do
scenario 'Disabled with a feature flag' do
Setting['feature.budgets'] = nil
expect{ visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
end
end
context "Index" do context "Index" do
scenario 'Displaying investmentss' do scenario 'Displaying investmentss' do