Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update expenses checker with simple maths fixes #239

Merged
merged 1 commit into from

2 participants

@jackfranklin

Small Maths fix (we were multiplying values we shouldn't have been).

@alext alext merged commit f150915 into master
@alext alext deleted the simplified_expenses_fix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 21, 2013
  1. @jackfranklin
This page is out of date. Refresh to see the latest.
View
6 lib/flows/simplified-expenses-checker.rb
@@ -168,9 +168,9 @@
calculate :simple_home_costs do
amount = case hours_worked_home
when 0..24 then 0
- when 25..50 then hours_worked_home * 120
- when 51..100 then hours_worked_home * 216
- else hours_worked_home * 312
+ when 25..50 then 120
+ when 51..100 then 216
+ else 312
end
Money.new(amount)
end
View
10 test/integration/flows/simplified_expenses_checker_test.rb
@@ -307,7 +307,7 @@ class SimplifiedExpensesCheckerTest < ActiveSupport::TestCase
should "calculate the simple_home_costs" do
add_response 25
assert_state_variable :hours_worked_home, 25.0
- assert_state_variable :simple_home_costs, 3000.0
+ assert_state_variable :simple_home_costs, 120.0
end
end
@@ -315,7 +315,7 @@ class SimplifiedExpensesCheckerTest < ActiveSupport::TestCase
should "calculate the simple_home_costs" do
add_response 55
assert_state_variable :hours_worked_home, 55.0
- assert_state_variable :simple_home_costs, 11880.0
+ assert_state_variable :simple_home_costs, 216.0
end
end
@@ -323,7 +323,7 @@ class SimplifiedExpensesCheckerTest < ActiveSupport::TestCase
should "calculate the simple_home_costs" do
add_response 101
assert_state_variable :hours_worked_home, 101.0
- assert_state_variable :simple_home_costs, 31512.0
+ assert_state_variable :simple_home_costs, 312.0
end
end
@@ -534,9 +534,9 @@ class SimplifiedExpensesCheckerTest < ActiveSupport::TestCase
should "calculate the correct values for the simplified_cost" do
assert_state_variable :simple_vehicle_costs, 2250
assert_state_variable :simple_motorcycle_costs, 240
- assert_state_variable :simple_home_costs, 3600
+ assert_state_variable :simple_home_costs, 120
assert_state_variable :simple_business_costs, 6000
- assert_state_variable :simple_costs, 12090
+ assert_state_variable :simple_costs, 8610
end
should "calculate the correct values for the current_scheme_cost" do
Something went wrong with that request. Please try again.