Sha256: 29b6eb45d364f1e8990ee58070cf196c82e58745bdfb2d16cb415cca3801eaf0

Contents?: true

Size: 799 Bytes

Versions: 8

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

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 described_class
  end

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
omniauth-identity-3.0.9 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.8 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.7 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.6 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.5 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.4 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.3 spec/omniauth/identity/secure_password_spec.rb
omniauth-identity-3.0.2 spec/omniauth/identity/secure_password_spec.rb