Sha256: 6cfecb5d195ac388c464dde34c52bafd68bdea96f30341e50743a79ab47f62e3

Contents?: true

Size: 1.49 KB

Versions: 19

Compression:

Stored size: 1.49 KB

Contents

require 'test_helper'

module PushType
  class AuthenticatableTest < ActiveSupport::TestCase

    let(:user) { PushType::User.new }

    describe 'database_athenticatable' do
      it { user.methods.include?(:password).must_equal true }
      it { user.methods.include?(:password_confirmation).must_equal true }
    end

    describe 'confirmable' do
      it { user.methods.include?(:confirm).must_equal true }
    end

    describe 'recoverable' do
      it { user.methods.include?(:reset_password).must_equal true }
    end

    describe 'rememberable' do
      it { user.methods.include?(:remember_me).must_equal true }
    end

    describe 'trackable' do
      it { user.methods.include?(:update_tracked_fields!).must_equal true }
    end

    describe 'validatable' do
      it { user.methods.include?(:password_required?).must_equal true }
      it { user.methods.include?(:email_required?).must_equal true }
    end

    describe '#password_required?' do
      subject { user.send(:password_required?) }
      describe 'with new user' do
        let(:user) { PushType::User.new }
        it { subject.must_equal false }
      end
      describe 'with existing user and clean password' do
        let(:user) { FactoryGirl.create :user }
        it { subject.must_equal false }
      end
      describe 'with existing user and dirty password' do
        let(:user) { FactoryGirl.create :user }
        before { user.password = 'newpassword' }
        it { subject.must_equal true }
      end
    end
    
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
push_type_auth-0.11.2 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.11.1 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.11.0.beta.2 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.11.0.beta.1 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.10.4 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.10.3 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.10.2 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.10.1 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.10.0 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.10.0.beta.5 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.10.0.beta.3 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.5 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.3 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.2 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.1 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.0 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.0.beta.4 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.0.beta.3 test/models/concerns/push_type/authenticatable_test.rb
push_type_auth-0.9.0.beta.2 test/models/concerns/push_type/authenticatable_test.rb