Sha256: 3b1165892b780d3dc24679f1a4c78941da9ee7d421fed8245e8a728ab82902e9

Contents?: true

Size: 985 Bytes

Versions: 2

Compression:

Stored size: 985 Bytes

Contents

require 'test_helper'
require 'integration_tests_helper'

class InvitationTest < ActionDispatch::IntegrationTest
  def teardown
    Capybara.reset_sessions!
  end

  test 'should have empty fields by default' do
    user = create_full_user
    assert_equal user.first_sign_in_at, nil
    assert_equal user.first_sign_in_ip, nil
  end

  test 'should have not rewrite fields after they filled' do
    time_stamp = 1.year.ago
    user = create_full_user({:first_sign_in_at => time_stamp, :first_sign_in_ip => '127.0.0.1'})
    sign_in_as_user user
    user.reload
    assert_equal user.first_sign_in_at, time_stamp
    assert_equal user.first_sign_in_ip, '127.0.0.1'
  end

  test 'should fill first sign fields on first sign in' do
    new_time = 2.seconds.from_now
    Time.stubs(:now).returns(new_time)
    user = create_full_user
    sign_in_as_user user
    user.reload
    assert_equal user.first_sign_in_at, new_time
    assert_equal user.first_sign_in_ip, '127.0.0.1'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise_imprintable-0.0.3 test/integration/inventable_test.rb
devise_imprintable-0.0.2 test/integration/inventable_test.rb