Sha256: ba36ef2da8c130d47ee368a9c6cd74181a98073cb53b444737394a34ba3df73f

Contents?: true

Size: 848 Bytes

Versions: 2

Compression:

Stored size: 848 Bytes

Contents

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
    expect(DoesNotHaveTheMethod).to 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
    expect(HasTheMethod).not_to 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)
      expect(klass).to be_respond_to(:has_secure_password)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
omniauth-identity-2.0.0 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity2-2.0 spec/omniauth/identity/secure_password_spec.rb