fixes false positive when storing previous heading id
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user