-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create standard deduction, update federal tax data migration. (#44)
* Update federal tax bracket data migration. * Add standard deduction to db. * Monetize standard deduction. * Add specs. * Update specs.
- Loading branch information
Showing
11 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# == Schema Information | ||
# | ||
# Table name: standard_deductions | ||
# | ||
# id :bigint not null, primary key | ||
# amount_cents :integer default(0), not null | ||
# amount_currency :string default("USD"), not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
class StandardDeduction < ApplicationRecord | ||
monetize :amount_cents | ||
|
||
validates :amount_cents, presence: true | ||
validates :amount_currency, presence: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class CreateStandardDeduction < ActiveRecord::Migration[7.0] | ||
def up | ||
# 2024 Standard Deduction is $13,850 | ||
StandardDeduction.create(amount: 13_850) | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
DataMigrate::Data.define(version: 20240711132613) | ||
DataMigrate::Data.define(version: 20240715131425) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class CreateStandardDeductions < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :standard_deductions do |t| | ||
t.monetize :amount | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# == Schema Information | ||
# | ||
# Table name: standard_deductions | ||
# | ||
# id :bigint not null, primary key | ||
# amount_cents :integer default(0), not null | ||
# amount_currency :string default("USD"), not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
FactoryBot.define do | ||
factory :standard_deduction do | ||
# standard deduction amount is $13,850 | ||
amount_cents { 1_385_000 } | ||
amount_currency { "USD" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# == Schema Information | ||
# | ||
# Table name: standard_deductions | ||
# | ||
# id :bigint not null, primary key | ||
# amount_cents :integer default(0), not null | ||
# amount_currency :string default("USD"), not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
require "rails_helper" | ||
|
||
RSpec.describe StandardDeduction, type: :model do | ||
it { is_expected.to validate_presence_of(:amount_cents) } | ||
it { is_expected.to validate_presence_of(:amount_currency) } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters