|
1124 | 1124 | end |
1125 | 1125 | end |
1126 | 1126 |
|
| 1127 | + describe "#calculate_line_39" do |
| 1128 | + context "when there is a value for line 34" do |
| 1129 | + before do |
| 1130 | + allow_any_instance_of(described_class).to receive(:calculate_line_34).and_return 500 |
| 1131 | + end |
| 1132 | + |
| 1133 | + it "returns line 34" do |
| 1134 | + instance.calculate |
| 1135 | + expect(instance.lines[:MD502_LINE_39].value).to eq 500 |
| 1136 | + end |
| 1137 | + end |
| 1138 | + |
| 1139 | + context "when line 34 is nil" do |
| 1140 | + it "returns 0" do |
| 1141 | + allow_any_instance_of(described_class).to receive(:calculate_line_34).and_return nil |
| 1142 | + instance.calculate |
| 1143 | + expect(instance.lines[:MD502_LINE_39].value).to eq 0 |
| 1144 | + end |
| 1145 | + end |
| 1146 | + end |
| 1147 | + |
1127 | 1148 | describe "#calculate_line_28_local_tax_rate" do |
1128 | 1149 | let(:taxable_net_income) { 10_000 } |
1129 | 1150 | before do |
|
1198 | 1219 | end |
1199 | 1220 | end |
1200 | 1221 |
|
| 1222 | + describe "#calculate_line_42" do |
| 1223 | + let(:filing_status) { "head_of_household" } |
| 1224 | + let(:df_xml_key) { "md_laney_qss" } |
| 1225 | + let!(:intake) { |
| 1226 | + create( |
| 1227 | + :state_file_md_intake, |
| 1228 | + filing_status: filing_status, |
| 1229 | + raw_direct_file_data: StateFile::DirectFileApiResponseSampleService.new.read_xml(df_xml_key) |
| 1230 | + ) |
| 1231 | + } |
| 1232 | + let(:federal_eic) { 1200 } |
| 1233 | + |
| 1234 | + before do |
| 1235 | + intake.direct_file_data.fed_eic = federal_eic |
| 1236 | + allow_any_instance_of(described_class).to receive(:calculate_line_21).and_return 500 |
| 1237 | + instance.calculate |
| 1238 | + end |
| 1239 | + |
| 1240 | + context "when there is least one qualifying child" do |
| 1241 | + context "when federal EIC * .45 is equal to or greater than Maryland tax (line 21)" do |
| 1242 | + it 'refundable EIC equals (federal EIC * .45) - Maryland tax (line 21)' do |
| 1243 | + expect(instance.lines[:MD502_LINE_42].value).to eq 40 # .45 of 1200 is 540. 540 - 500 |
| 1244 | + end |
| 1245 | + end |
| 1246 | + |
| 1247 | + context "when federal EIC * .45 is less than than Maryland tax (line 21)" do |
| 1248 | + before do |
| 1249 | + intake.direct_file_data.fed_eic = federal_eic |
| 1250 | + allow_any_instance_of(described_class).to receive(:calculate_line_21).and_return 600 |
| 1251 | + instance.calculate |
| 1252 | + end |
| 1253 | + it 'refundable EIC is 0' do |
| 1254 | + expect(instance.lines[:MD502_LINE_42].value).to eq 0 |
| 1255 | + end |
| 1256 | + end |
| 1257 | + end |
| 1258 | + |
| 1259 | + context "when mfj and no qualifying children" do |
| 1260 | + let(:filing_status) { "married_filing_jointly" } |
| 1261 | + let(:df_xml_key) { "md_zeus_two_w2s" } |
| 1262 | + it 'refundable EIC equals (federal EIC * .45) - Maryland tax (line 21)' do |
| 1263 | + expect(instance.lines[:MD502_LINE_42].value).to eq 40 |
| 1264 | + end |
| 1265 | + end |
| 1266 | + |
| 1267 | + context "when single and no qualifying children" do |
| 1268 | + let(:filing_status) { "single" } |
| 1269 | + let(:df_xml_key) { "md_zeus_two_w2s" } |
| 1270 | + |
| 1271 | + context "when federal EIC is equal to or greater than Maryland tax (line 21)" do |
| 1272 | + it "refundable EIC equals - Maryland tax (line 21)" do |
| 1273 | + expect(instance.lines[:MD502_LINE_42].value).to eq 700 |
| 1274 | + end |
| 1275 | + end |
| 1276 | + |
| 1277 | + context "when federal EIC is less than than Maryland tax (line 21)" do |
| 1278 | + before do |
| 1279 | + intake.direct_file_data.fed_eic = federal_eic |
| 1280 | + allow_any_instance_of(described_class).to receive(:calculate_line_21).and_return 1500 |
| 1281 | + instance.calculate |
| 1282 | + end |
| 1283 | + it 'refundable EIC is 0' do |
| 1284 | + expect(instance.lines[:MD502_LINE_42].value).to eq 0 |
| 1285 | + end |
| 1286 | + end |
| 1287 | + end |
| 1288 | + |
| 1289 | + context "when filing as a dependent and no qualifying children" do |
| 1290 | + let(:filing_status) { "dependent" } |
| 1291 | + let(:df_xml_key) { "md_zeus_two_w2s" } |
| 1292 | + it 'refundable EIC is nil' do |
| 1293 | + expect(instance.lines[:MD502_LINE_42].value).to eq nil |
| 1294 | + end |
| 1295 | + end |
| 1296 | + end |
| 1297 | + |
1201 | 1298 | describe "#calculate_line_28_local_tax_amount" do |
1202 | 1299 | before do |
1203 | 1300 | allow_any_instance_of(described_class).to receive(:calculate_line_20).and_return 300_000 |
|
1258 | 1355 | end |
1259 | 1356 | end |
1260 | 1357 |
|
| 1358 | + describe "#calculate_line_44" do |
| 1359 | + before do |
| 1360 | + allow_any_instance_of(described_class).to receive(:calculate_line_40).and_return 250 |
| 1361 | + allow_any_instance_of(described_class).to receive(:calculate_line_42).and_return 200 |
| 1362 | + allow_any_instance_of(described_class).to receive(:calculate_line_43).and_return 150 |
| 1363 | + end |
| 1364 | + it "sums lines 40 to 44" do |
| 1365 | + instance.calculate |
| 1366 | + expect(instance.lines[:MD502_LINE_44].value).to eq(600) |
| 1367 | + end |
| 1368 | + end |
| 1369 | + |
| 1370 | + describe "#calculate_line_45" do |
| 1371 | + context "line 39 is less than 44" do |
| 1372 | + before do |
| 1373 | + allow_any_instance_of(described_class).to receive(:calculate_line_39).and_return 50 |
| 1374 | + allow_any_instance_of(described_class).to receive(:calculate_line_44).and_return 150 |
| 1375 | + end |
| 1376 | + it "returns nil" do |
| 1377 | + instance.calculate |
| 1378 | + expect(instance.lines[:MD502_LINE_45].value).to eq(nil) |
| 1379 | + end |
| 1380 | + end |
| 1381 | + |
| 1382 | + context "line 39 is more than 44" do |
| 1383 | + before do |
| 1384 | + allow_any_instance_of(described_class).to receive(:calculate_line_39).and_return 1_000 |
| 1385 | + allow_any_instance_of(described_class).to receive(:calculate_line_44).and_return 900 |
| 1386 | + end |
| 1387 | + it "subtracts line 39 from line 44" do |
| 1388 | + instance.calculate |
| 1389 | + expect(instance.lines[:MD502_LINE_45].value).to eq(100) |
| 1390 | + expect(instance.lines[:MD502_LINE_50].value).to eq(100) |
| 1391 | + end |
| 1392 | + end |
| 1393 | + end |
| 1394 | + |
| 1395 | + describe "#calculate_line_46" do |
| 1396 | + context "line 39 is less than 44" do |
| 1397 | + before do |
| 1398 | + allow_any_instance_of(described_class).to receive(:calculate_line_39).and_return 900 |
| 1399 | + allow_any_instance_of(described_class).to receive(:calculate_line_44).and_return 1_000 |
| 1400 | + end |
| 1401 | + it "subtracts line 39 from line 44" do |
| 1402 | + instance.calculate |
| 1403 | + expect(instance.lines[:MD502_LINE_46].value).to eq(100) |
| 1404 | + expect(instance.lines[:MD502_LINE_48].value).to eq(100) |
| 1405 | + end |
| 1406 | + end |
| 1407 | + |
| 1408 | + context "line 39 is more than 44" do |
| 1409 | + before do |
| 1410 | + allow_any_instance_of(described_class).to receive(:calculate_line_39).and_return 150 |
| 1411 | + allow_any_instance_of(described_class).to receive(:calculate_line_44).and_return 50 |
| 1412 | + end |
| 1413 | + it "returns nil" do |
| 1414 | + instance.calculate |
| 1415 | + expect(instance.lines[:MD502_LINE_46].value).to eq(nil) |
| 1416 | + end |
| 1417 | + end |
| 1418 | + end |
| 1419 | + |
1261 | 1420 | describe "#calculate_line_30" do |
1262 | 1421 | context "deduction method is standard and they qualify for state poverty level credit" do |
1263 | 1422 | before do |
|
1383 | 1542 |
|
1384 | 1543 | describe "refund_or_owed_amount" do |
1385 | 1544 | it "subtracts owed amount from refund amount" do |
1386 | | - # TEMP: stub calculator lines and test outcome of method once implemented |
1387 | | - expect(instance.refund_or_owed_amount).to eq(0) |
| 1545 | + allow(instance).to receive(:calculate_line_48).and_return 0 |
| 1546 | + allow(instance).to receive(:calculate_line_50).and_return -30 |
| 1547 | + instance.calculate |
| 1548 | + expect(instance.refund_or_owed_amount).to eq(30) |
1388 | 1549 | end |
1389 | 1550 | end |
1390 | 1551 |
|
|
0 commit comments