fixes false positive when storing previous heading id

This commit is contained in:
rgarcia
2017-05-14 11:38:05 +02:00
parent 94361eb663
commit 62b2f4812b
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