Spec fixed
This commit is contained in:
@@ -26,17 +26,22 @@ describe Budget::Heading do
|
||||
end
|
||||
|
||||
describe "Save population" do
|
||||
it "Allows nil for population" do
|
||||
expect(create(:budget_heading, group: group, name: 'Population is nil')).to be_valid
|
||||
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 0 for population" do
|
||||
expect(create(:budget_heading, group: group, name: 'Population is 0', population: 0)).not_to be_valid
|
||||
end
|
||||
|
||||
it "Allows value > 0 for population" do
|
||||
expect(create(:budget_heading, group: group, name: 'Population is 10', population: 10)).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
|
||||
|
||||
Reference in New Issue
Block a user