diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index 4edad349f..2633724ac 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -104,6 +104,7 @@ en:
table_heading: Heading
table_amount: Amount
table_population: Population
+ population_info: "Budget Heading population field is used for Statistic purposes at the end of the Budget to show for each Heading that represents an area with population what percentage voted. The field is optional so you can leave it empty if it doesn't apply."
winners:
calculate: Calculate Winner Investments
calculated: Winners being calculated, it may take a minute.
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 44cfa7600..067684df9 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -104,6 +104,7 @@ es:
table_heading: Partida
table_amount: Cantidad
table_population: Población
+ population_info: "El campo población de las partidas presupuestarias se usa con fines estadísticos únicamente, con el objetivo de mostrar el porcentaje de votos habidos en cada partida que represente un área con población. Es un campo opcional, así que puedes dejarlo en blanco si no aplica."
winners:
calculate: Calcular propuestas ganadoras
calculated: Calculando ganadoras, puede tardar un minuto.
diff --git a/spec/models/budget/heading_spec.rb b/spec/models/budget/heading_spec.rb
index ee2e4c142..76df1fa5c 100644
--- a/spec/models/budget/heading_spec.rb
+++ b/spec/models/budget/heading_spec.rb
@@ -25,4 +25,23 @@ describe Budget::Heading do
end
end
+ describe "Save population" do
+ it "Allows population == nil" do
+ expect(create(:budget_heading, group: group, name: 'Population is nil', population: nil)).to be_valid
+ end
+
+ it "Doesn't allow population <= 0" do
+ heading = create(:budget_heading, group: group, name: 'Population is > 0')
+
+ heading.population = 0
+ expect(heading).not_to be_valid
+
+ heading.population = -10
+ expect(heading).not_to be_valid
+
+ heading.population = 10
+ expect(heading).to be_valid
+ end
+ end
+
end