fixes false positive when storing previous heading id
This commit is contained in:
@@ -255,7 +255,7 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def log_reclassification
|
def log_reclassification
|
||||||
self.previous_heading_id = self.heading_id_was
|
update_column(:previous_heading_id, heading_id_was)
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_reclassified_votes
|
def remove_reclassified_votes
|
||||||
|
|||||||
@@ -715,9 +715,13 @@ describe Budget::Investment do
|
|||||||
it "stores the previous heading before being reclassified" do
|
it "stores the previous heading before being reclassified" do
|
||||||
investment = create(:budget_investment, heading: heading1)
|
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.heading = heading2
|
||||||
investment.save
|
investment.save
|
||||||
|
|
||||||
|
investment.reload
|
||||||
expect(investment.heading_id).to eq(heading2.id)
|
expect(investment.heading_id).to eq(heading2.id)
|
||||||
expect(investment.previous_heading_id).to eq(heading1.id)
|
expect(investment.previous_heading_id).to eq(heading1.id)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user