Display message in budget's index when there are no budgets
When there are no budgets we were seeing an exception in the budgets’ index There are two parts to take into account here: 1) Making sure there is a current_budget present, otherwise we display the “no budgets” message 2) The map helper is called from the controller, so we need to make sure current_budget is present there too Note: We could have added a bunch of `try` statements in the budgets’s index, instead of using a conditional, however there are quite a few `current_budget` calls so it seems more appropriate to use a conditional
This commit is contained in:
@@ -117,6 +117,13 @@ feature 'Budgets' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "No budgets" do
|
||||
Budget.destroy_all
|
||||
|
||||
visit budgets_path
|
||||
|
||||
expect(page).to have_content "There are no budgets"
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Index shows only published phases' do
|
||||
|
||||
Reference in New Issue
Block a user