Sha256: 246ef5a58d8f3ad4d7233b53f56d65c9e82bc05a0e11ab24645433711194a9ca

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

require 'test/test_helper'

class Invitable < User
  devise :database_authenticatable, :invitable, :invite_for => 5.days
end

class ActiveRecordTest < ActiveSupport::TestCase
  def include_module?(klass, mod)
    klass.devise_modules.include?(mod) &&
    klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
  end

  def assert_include_modules(klass, *modules)
    modules.each do |mod|
      assert include_module?(klass, mod), "#{klass} not include #{mod}"
    end
  end

  test 'add invitable module only' do
    assert_include_modules Invitable, :invitable
  end

  test 'set a default value for invite_for' do
    assert_equal 5.days, Invitable.invite_for
  end

  test 'invitable attributes' do
    assert_not_nil Invitable.columns_hash['invitation_token']
    assert_not_nil Invitable.columns_hash['invitation_sent_at']
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise_invitable-0.3.5 test/models_test.rb
devise_invitable-0.3.4 test/models_test.rb
devise_invitable-0.3.2 test/models_test.rb
devise_invitable-0.3.1 test/models_test.rb