Fixes admin menu link when create a new widget

This commit is contained in:
decabeza
2018-11-08 12:53:33 +01:00
parent 06969e0ec7
commit 13b3d9cebc
3 changed files with 15 additions and 10 deletions

View File

@@ -9,12 +9,8 @@ module AdminHelper
end
def namespaced_root_path
if namespace == 'moderation/budgets'
"/moderation"
else
"/#{namespace}"
end
end
def namespaced_header_title
if namespace == 'moderation/budgets'
@@ -95,7 +91,7 @@ module AdminHelper
private
def namespace
controller.class.parent.name.downcase.gsub("::", "/")
controller.class.name.downcase.split("::").first
end
end

View File

@@ -27,7 +27,7 @@ module BudgetsHelper
def namespaced_budget_investment_path(investment, options = {})
case namespace
when "management/budgets"
when "management"
management_budget_investment_path(investment.budget, investment, options)
else
budget_investment_path(investment.budget, investment, options)
@@ -36,7 +36,7 @@ module BudgetsHelper
def namespaced_budget_investment_vote_path(investment, options = {})
case namespace
when "management/budgets"
when "management"
vote_management_budget_investment_path(investment.budget, investment, options)
else
vote_budget_investment_path(investment.budget, investment, options)

View File

@@ -19,7 +19,16 @@ feature 'Homepage' do
let(:user_recommendations) { Setting.where(key: 'feature.user.recommendations').first }
let(:user) { create(:user) }
scenario "Header" do
context "Header" do
scenario "Admin menu links to homepage path" do
visit new_admin_widget_card_path(header_card: true)
click_link Setting['org_name'] + " Administration"
expect(page).to have_current_path(admin_root_path)
end
end
context "Feeds" do