Skip to content

Commit

Permalink
FYST-1826 Fix 502SU bug where the calculation was referring to the pr…
Browse files Browse the repository at this point in the history
…imary as opposed to spouse (#5606)
  • Loading branch information
anisharamnani authored Feb 21, 2025
1 parent a483170 commit d7954ca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/lib/efile/md/md502_su_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def calculate

def calculate_military_per_filer(filer)
age_benefits = @intake.is_filer_55_and_older?(filer) ? 20_000 : 12_500
[@intake.sum_1099_r_followup_type_for_filer(:primary, :service_type_military?), age_benefits].min
[@intake.sum_1099_r_followup_type_for_filer(filer, :service_type_military?), age_benefits].min
end

def calculate_public_safety_employee(filer)
Expand Down
49 changes: 24 additions & 25 deletions spec/lib/efile/md/md502_su_calculator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,36 @@
end

describe "#calculate_military_per_filer" do
context "when the taxable amount is higher than the age benefit amount" do
before do
allow_any_instance_of(StateFileMdIntake).to receive(:sum_1099_r_followup_type_for_filer).and_return 30_000
allow_any_instance_of(StateFileMdIntake).to receive(:is_filer_55_and_older?).and_return is_55_and_older
end
[:primary, :spouse].each do |filer|
context "when the taxable amount is higher than the age benefit amount" do
before do
allow_any_instance_of(StateFileMdIntake).to receive(:sum_1099_r_followup_type_for_filer).with(filer, :service_type_military?).and_return 30_000
allow_any_instance_of(StateFileMdIntake).to receive(:is_filer_55_and_older?).with(filer).and_return is_55_and_older
end

context "when the filer is older than 55" do
let(:is_55_and_older) { true }
it "returns 20,000" do
expect(instance.calculate_military_per_filer(:primary)).to eq(20_000)
expect(instance.calculate_military_per_filer(:spouse)).to eq(20_000)
context "when the filer is older than 55" do
let(:is_55_and_older) { true }
it "returns 20,000" do
expect(instance.calculate_military_per_filer(filer)).to eq(20_000)
end
end
end

context "when the filer is younger than 55" do
let(:is_55_and_older) { false }
it "returns 12,500" do
expect(instance.calculate_military_per_filer(:primary)).to eq(12_500)
expect(instance.calculate_military_per_filer(:spouse)).to eq(12_500)
context "when the filer is younger than 55" do
let(:is_55_and_older) { false }
it "returns 12,500" do
expect(instance.calculate_military_per_filer(filer)).to eq(12_500)
end
end
end
end

context "when the taxable amount is lower than the age benefit amount" do
before do
allow_any_instance_of(StateFileMdIntake).to receive(:sum_1099_r_followup_type_for_filer).and_return 10_000
allow_any_instance_of(StateFileMdIntake).to receive(:is_filer_55_and_older?).and_return false
end
it "returns the taxable amount" do
expect(instance.calculate_military_per_filer(:primary)).to eq(10_000)
expect(instance.calculate_military_per_filer(:spouse)).to eq(10_000)
context "when the taxable amount is lower than the age benefit amount" do
before do
allow_any_instance_of(StateFileMdIntake).to receive(:sum_1099_r_followup_type_for_filer).with(filer, :service_type_military?).and_return 10_000
allow_any_instance_of(StateFileMdIntake).to receive(:is_filer_55_and_older?).with(filer).and_return false
end
it "returns the taxable amount" do
expect(instance.calculate_military_per_filer(filer)).to eq(10_000)
end
end
end
end
Expand Down

0 comments on commit d7954ca

Please sign in to comment.