Sha256: 20be7e45749ed691797bc8ff35cda76231ae1f1d844f66e308b154f65a07cef3

Contents?: true

Size: 859 Bytes

Versions: 7

Compression:

Stored size: 859 Bytes

Contents

require 'spec_helper'

class HasTheMethod
  def self.has_secure_password; end
end

class DoesNotHaveTheMethod
end

describe OmniAuth::Identity::SecurePassword do
  it 'should extend with the class methods if it does not have the method' do
    DoesNotHaveTheMethod.should_receive(:extend).with(OmniAuth::Identity::SecurePassword::ClassMethods)
    DoesNotHaveTheMethod.send(:include, OmniAuth::Identity::SecurePassword)
  end

  it 'should not extend if the method is already defined' do
    HasTheMethod.should_not_receive(:extend)
    HasTheMethod.send(:include, OmniAuth::Identity::SecurePassword)
  end

  it 'should respond to has_secure_password afterwards' do
    [HasTheMethod,DoesNotHaveTheMethod].each do |klass|
      klass.send(:include, OmniAuth::Identity::SecurePassword)
      klass.should be_respond_to(:has_secure_password)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
omniauth-identity-1.1.1 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-1.1.0 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-1.0.0 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-1.0.0.rc2 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-1.0.0.rc1 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-1.0.0.beta1 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-1.0.0.pr2 spec/omniauth/identity/secure_password_spec.rb