Sha256: ab1cb3b6f9bd191b499a6dd64de5fd7b365b4400d2cba4ddbf2f740a6b2d05bc

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

class HasTheMethod
  def self.has_secure_password; end
end

class DoesNotHaveTheMethod
end

RSpec.describe OmniAuth::Identity::SecurePassword do
  it 'extends with the class methods if it does not have the method' do
    expect(DoesNotHaveTheMethod).to receive(:extend).with(OmniAuth::Identity::SecurePassword::ClassMethods)
    DoesNotHaveTheMethod.include OmniAuth::Identity::SecurePassword
  end

  it 'does not extend if the method is already defined' do
    expect(HasTheMethod).not_to receive(:extend)
    HasTheMethod.include OmniAuth::Identity::SecurePassword
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-identity-3.0.1 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.0 spec/omniauth/identity/secure_password_spec.rb