roth_ira 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a7bbd77d6a3283c63e435ca850c4d6935621f37
4
- data.tar.gz: 01be66098e85fb161399ca7b43b56f68ee61b04d
3
+ metadata.gz: 4209f2102ebc933fee5d0e0d6b3c8ccc37884b8b
4
+ data.tar.gz: 9bac372e285a229dbffed6624f3ba9749487feab
5
5
  SHA512:
6
- metadata.gz: 5637387863f8e81764a364750842fa8685ad9c014252c64ce2c4e2620b9239ca620ec832fe32e8271c8158864238afea10881908a045a6b9a4d516fcdf194d2b
7
- data.tar.gz: c6450b1b50a392c65bca6039076b4ea759946acc7953d133ded5236dcde46601e9631f18066830b1771911549a2353a8bf05a99a6251c8f712af5c60948c2381
6
+ metadata.gz: 0fc85a36f9aa8043c8e8caf25f7280a1fa54780a612d5c8c6cf5871286bd202f9052299bfe7d5814e5467ed9352a8aaea54db75715cf79b544f098cba4576b69
7
+ data.tar.gz: 57df9b0da8afc23a1d106c40ebe972d52ca03f84b842d51a986be8d2ce4456a826dc9cfc1484792907e2bf8c964488c8b432aa96ad9fdb35fd039a75d4b65126
data/lib/limits.yaml CHANGED
@@ -53,3 +53,21 @@
53
53
  :minimum_phase_out: 400
54
54
  :catch_up_contribution: 1000
55
55
  :catch_up_age: 50
56
+ 2018:
57
+ :single:
58
+ :lower_income_limit: 120000
59
+ :upper_income_limit: 135000
60
+ :contribution_limit: 5500
61
+ :minimum_phase_out: 200
62
+ :head_of_household:
63
+ :lower_income_limit: 120000
64
+ :upper_income_limit: 135000
65
+ :contribution_limit: 5500
66
+ :minimum_phase_out: 200
67
+ :married_filing_jointly:
68
+ :lower_income_limit: 189000
69
+ :upper_income_limit: 199000
70
+ :contribution_limit: 11000
71
+ :minimum_phase_out: 400
72
+ :catch_up_contribution: 1000
73
+ :catch_up_age: 50
data/lib/roth_ira.rb CHANGED
@@ -4,6 +4,7 @@ class RothIRA
4
4
  attr_reader :age, :agi, :filing_status, :limits, :spouse_age, :year
5
5
 
6
6
  def initialize(year)
7
+ raise(ArgumentError, "Invalid Tax Year #{year}") unless year.between?(2015, 2018)
7
8
  @year = year
8
9
  @limits = YAML.load(File.read(__dir__ + "/limits.yaml"))[year]
9
10
  end
@@ -1,3 +1,3 @@
1
1
  class RothIRA
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -2,7 +2,27 @@ require 'spec_helper'
2
2
 
3
3
  describe RothIRA do
4
4
  it 'should return correct version string' do
5
- expect(RothIRA::VERSION).to eq('1.2.0')
5
+ expect(RothIRA::VERSION).to eq('1.2.1')
6
+ end
7
+
8
+ context 'Invalid tax years' do
9
+ it 'should raise an ArgumentError if tax year is before 2015' do
10
+ expect{RothIRA.new(2014)}.to raise_error ArgumentError
11
+ end
12
+
13
+ it 'should raise an ArgumentError if tax year is after 2018' do
14
+ expect{RothIRA.new(2019)}.to raise_error ArgumentError
15
+ end
16
+ end
17
+
18
+ context 'Valid tax years' do
19
+ it 'should not raise an ArgumentError if tax year is 2015' do
20
+ expect{RothIRA.new(2015)}.to_not raise_error
21
+ end
22
+
23
+ it 'should not raise an ArgumentError if tax year is 2018' do
24
+ expect{RothIRA.new(2018)}.to_not raise_error
25
+ end
6
26
  end
7
27
 
8
28
  context 'Tax year 2015' do
@@ -311,4 +331,69 @@ describe RothIRA do
311
331
  end
312
332
  end
313
333
  end
334
+
335
+ context 'Tax year 2018' do
336
+ let(:roth_ira) { RothIRA.new(2018) }
337
+ context 'Single' do
338
+ it 'returns maximum contribution for bottom of income limit' do
339
+ expect(roth_ira.calculate(120000, :single, 40)).to eq(5500)
340
+ end
341
+
342
+ it 'returns maximum contribution for bottom of income limit with catch-up' do
343
+ expect(roth_ira.calculate(120000, :single, 50)).to eq(6500)
344
+ end
345
+
346
+ it 'returns zero contribution for top of income limit' do
347
+ expect(roth_ira.calculate(135000, :single, 40)).to eq(0)
348
+ end
349
+
350
+ it 'returns maximum contribution for bottom of income limit with catch-up' do
351
+ expect(roth_ira.calculate(135000, :single, 50)).to eq(0)
352
+ end
353
+ end
354
+
355
+ context 'Head of Household' do
356
+ it 'returns maximum contribution for bottom of income limit' do
357
+ expect(roth_ira.calculate(120000, :head_of_household, 40)).to eq(5500)
358
+ end
359
+
360
+ it 'returns maximum contribution for bottom of income limit with catch-up' do
361
+ expect(roth_ira.calculate(120000, :head_of_household, 50)).to eq(6500)
362
+ end
363
+
364
+ it 'returns zero contribution for top of income limit' do
365
+ expect(roth_ira.calculate(135000, :head_of_household, 40)).to eq(0)
366
+ end
367
+
368
+ it 'returns maximum contribution for bottom of income limit with catch-up' do
369
+ expect(roth_ira.calculate(135000, :head_of_household, 50)).to eq(0)
370
+ end
371
+ end
372
+
373
+ context 'Married Filing Jointly' do
374
+ it 'returns maximum contribution for bottom of income limit' do
375
+ expect(roth_ira.calculate(189000, :married_filing_jointly, 40, 40)).to eq(11000)
376
+ end
377
+
378
+ it 'returns maximum contribution for bottom of income limit with one catch-up' do
379
+ expect(roth_ira.calculate(189000, :married_filing_jointly, 40, 50)).to eq(12000)
380
+ end
381
+
382
+ it 'returns maximum contribution for bottom of income limit with both catch-up' do
383
+ expect(roth_ira.calculate(189000, :married_filing_jointly, 50, 50)).to eq(13000)
384
+ end
385
+
386
+ it 'returns zero contribution for top of income limit' do
387
+ expect(roth_ira.calculate(199000, :married_filing_jointly, 40, 40)).to eq(0)
388
+ end
389
+
390
+ it 'returns maximum contribution for bottom of income limit with one catch-up' do
391
+ expect(roth_ira.calculate(199000, :married_filing_jointly, 40, 50)).to eq(0)
392
+ end
393
+
394
+ it 'returns maximum contribution for bottom of income limit with both catch-up' do
395
+ expect(roth_ira.calculate(199000, :married_filing_jointly, 50, 50)).to eq(0)
396
+ end
397
+ end
398
+ end
314
399
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roth_ira
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Randall Reed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-13 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  requirements: []
59
59
  rubyforge_project:
60
- rubygems_version: 2.4.8
60
+ rubygems_version: 2.6.11
61
61
  signing_key:
62
62
  specification_version: 4
63
63
  summary: Roth IRA Contribution Limit Calculator