Sha256: 54ef2f7f2d7ffbf3303020b169fd4836123db06be6ea37859c87e4dff063475d
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require "test_helper" class TrackableTest < ActiveSupport::TestCase test 'update_tracked_fields!' do Timecop.freeze Time.now do user = Fabricate(:user, last_login_at: 2.days.ago.utc, current_login_at: 1.hour.ago.utc, last_login_ip: '127.0.0.1', current_login_ip: '127.0.0.2', login_count: 2) request = stub(remote_ip: '127.0.0.3') user.update_tracked_fields!(request) user.reload assert_equal 1.hour.ago.utc.to_s, user.last_login_at.to_s assert_equal Time.now.utc.to_s, user.current_login_at.to_s assert_equal '127.0.0.2', user.last_login_ip assert_equal '127.0.0.3', user.current_login_ip assert_equal 3, user.login_count end end test 'update_tracked_fields! for the first time' do Timecop.freeze Time.now do user = Fabricate(:user) request = stub(remote_ip: '127.0.0.3') user.update_tracked_fields!(request) user.reload assert_equal Time.now.utc.to_s, user.last_login_at.to_s assert_equal Time.now.utc.to_s, user.current_login_at.to_s assert_equal '127.0.0.3', user.last_login_ip assert_equal '127.0.0.3', user.current_login_ip assert_equal 1, user.login_count end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
goma-0.0.1.rc3 | test/models/trackable_test.rb |
goma-0.0.1.rc2 | test/models/trackable_test.rb |