Merge pull request #1538 from consul/reclassification-polish

fixes false positive when storing previous heading id
This commit is contained in:
Raimond Garcia
2017-05-14 12:06:31 +02:00
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@@ -255,7 +255,7 @@ class Budget
end
def log_reclassification
self.previous_heading_id = self.heading_id_was
update_column(:previous_heading_id, heading_id_was)
end
def remove_reclassified_votes

View File

@@ -715,9 +715,13 @@ describe Budget::Investment do
it "stores the previous heading before being reclassified" do
investment = create(:budget_investment, heading: heading1)
expect(investment.heading_id).to eq(heading1.id)
expect(investment.previous_heading_id).to eq(nil)
investment.heading = heading2
investment.save
investment.reload
expect(investment.heading_id).to eq(heading2.id)
expect(investment.previous_heading_id).to eq(heading1.id)
end