merged initial codebase
[smr.git] / gui / test / functional / smr_asset_test.rb
blobc20d9ce900cfba1bc9c03986bce3c5d99106505a
2 # This file is part of SMR.
4 # SMR is free software: you can redistribute it and/or modify it under the
5 # terms of the GNU General Public License as published by the Free Software
6 # Foundation, either version 3 of the License, or (at your option) any later
7 # version.
9 # SMR is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # SMR.  If not, see <http://www.gnu.org/licenses/>.
16 require 'test_helper'
18 class SmrAssetTest < ActionController::TestCase
20     ##
21     # test time machine by verifying investment sums at certain dates
22     #
23     # this is using the admin user with id_user=>1
24     test 'invested' do
25         to_test = [
26             {:at=>Time.new(2003,5,23), :invested=>225.0},
27             {:at=>Time.new(2004,5,23), :invested=>7162.95},
28             {:at=>Time.new(2014,5,23), :invested=>10570.05},
29             {:at=>Time.new(2014,6,20), :invested=>12068.85},
30         ]
32         to_test.each do |ta|
33             a = SmrAsset.new(1, ta[:at])
34             assert_equal a.invested, ta[:invested], 'wrong investment total at %s' % ta[:at]
35         end
36     end
37 end