Sha256: 4d1124aa7c56796541470088749da9123944cc9ce16501180aec96ef06fec8b6

Contents?: true

Size: 1014 Bytes

Versions: 1

Compression:

Stored size: 1014 Bytes

Contents

require "test_helper"

class InactivatableTest < ActiveSupport::TestCase
  include Support::Assertions
  include Support::Factories

  test '#inactivated_at should be nil when admin created' do
    assert_nil create_admin.inactivated_at
  end

  test '#inactivate! should set #inactivated_at' do
    admin = create_admin
    assert_not admin.inactivated_at.present?
    admin.inactivate!
    assert admin.inactivated_at.present?
  end

  test '#activate! should set #inactivated_at with nil' do
    admin = create_admin(:inactivated_at => Time.now)
    assert admin.inactivated_at.present?
    admin.activate!
    assert_not admin.inactivated_at.present?
  end

  test '#active? should be true when actived' do
    admin = create_admin(:inactivated_at => Time.now)
    assert_not admin.active?
    admin.activate!
    assert admin.active?
  end

  test '#inactive? should be true when inactived' do
    admin = create_admin
    assert_not admin.inactive?
    admin.inactivate!
    assert admin.inactive?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_inactivatable-1.0.3 test/devise/inactivatable/inactivatable_test.rb