Skip to content

Commit

Permalink
Clean up tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 13, 2010
1 parent efc0ae2 commit 66f4cfd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 344 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rdoc
@@ -1,3 +1,6 @@
* deprecation
* devise :all is deprecated

* enhancements
* Added devise lockable (by github/mhfs)

Expand Down
2 changes: 1 addition & 1 deletion README.rdoc
Expand Up @@ -160,7 +160,7 @@ The devise method in your models also accept some options to configure its modul

devise :authenticatable, :confirmable, :recoverable, :encryptor => :bcrypt

Besides :encryptor, you can provide :pepper, :stretches, :confirm_within, :remember_for, :timeout, :unlock_in and others. All those are describer in the initializer created when you invoke the devise_install generator describer above.
Besides :encryptor, you can provide :pepper, :stretches, :confirm_within, :remember_for, :timeout_in, :unlock_in and others. All those are describer in the initializer created when you invoke the devise_install generator describer above.

== Views

Expand Down
93 changes: 9 additions & 84 deletions test/models_test.rb
@@ -1,51 +1,9 @@
require 'test/test_helper'

class Authenticatable < User
devise :authenticatable
end

class Confirmable < User
devise :authenticatable, :confirmable
end

class Recoverable < User
devise :authenticatable, :recoverable
end

class Rememberable < User
devise :authenticatable, :rememberable
end

class Trackable < User
devise :authenticatable, :trackable
end

class Timeoutable < User
devise :authenticatable, :timeoutable
end

class Lockable < User
devise :authenticatable, :lockable
end

class IsValidatable < User
devise :authenticatable, :validatable
end

class Devisable < User
devise :all
end

class Exceptable < User
devise :all, :except => [:recoverable, :rememberable, :validatable, :lockable]
end

class Configurable < User
devise :all, :timeoutable, :stretches => 15,
:pepper => 'abcdef',
:confirm_within => 5.days,
:remember_for => 7.days,
:timeout_in => 15.minutes
devise :authenticatable, :confirmable, :rememberable, :timeoutable, :lockable,
:stretches => 15, :pepper => 'abcdef', :confirm_within => 5.days,
:remember_for => 7.days, :timeout_in => 15.minutes, :unlock_in => 10.days
end

class ActiveRecordTest < ActiveSupport::TestCase
Expand All @@ -64,45 +22,8 @@ def assert_include_modules(klass, *modules)
end
end

test 'add authenticatable module only' do
assert_include_modules Authenticatable, :authenticatable
end

test 'add confirmable module only' do
assert_include_modules Confirmable, :authenticatable, :confirmable
end

test 'add recoverable module only' do
assert_include_modules Recoverable, :authenticatable, :recoverable
end

test 'add rememberable module only' do
assert_include_modules Rememberable, :authenticatable, :rememberable
end

test 'add trackable module only' do
assert_include_modules Trackable, :authenticatable, :trackable
end

test 'add timeoutable module only' do
assert_include_modules Timeoutable, :authenticatable, :timeoutable
end

test 'add lockable module only' do
assert_include_modules Lockable, :authenticatable, :lockable
end

test 'add validatable module only' do
assert_include_modules IsValidatable, :authenticatable, :validatable
end

test 'add all modules' do
assert_include_modules Devisable,
:authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable
end

test 'configure modules with except option' do
assert_include_modules Exceptable, :authenticatable, :confirmable, :trackable
test 'add modules cherry pick' do
assert_include_modules Admin, :authenticatable, :timeoutable
end

test 'set a default value for stretches' do
Expand All @@ -125,6 +46,10 @@ def assert_include_modules(klass, *modules)
assert_equal 15.minutes, Configurable.timeout_in
end

test 'set a default value for unlock_in' do
assert_equal 10.days, Configurable.unlock_in
end

test 'set null fields on migrations' do
Admin.create!
end
Expand Down
243 changes: 0 additions & 243 deletions test/rails_app/README

This file was deleted.

7 changes: 0 additions & 7 deletions test/rails_app/app/active_record/account.rb

This file was deleted.

9 changes: 0 additions & 9 deletions test/rails_app/app/mongo_mapper/account.rb

This file was deleted.

0 comments on commit 66f4cfd

Please sign in to comment.