Sha256: 4fa52b5a6afe7619adcae6316c3eccf3931dd7bd49acbca852b25ca57cc22ad9

Contents?: true

Size: 727 Bytes

Versions: 4

Compression:

Stored size: 727 Bytes

Contents

require "devise_zxcvbn"

describe 'Devise zxcvbn' do

  it "Returns the default value for min_password_score of 4" do
    expect(Devise.min_password_score).to eq(4)
  end

  it "Raises an error if min_password_score value is out of range" do
    expect { Devise.min_password_score = 8 }.to raise_error("The min_password_score must be an integer and between 0..4")
  end

  it "Sets the min_password_score value" do
    Devise.min_password_score = 2
    expect(Devise.min_password_score).to eq(2)
    Devise.min_password_score = 4 # Restore default
  end

  it "returns a memoized instance of Zxcvbn::Tester" do
    expect(::Zxcvbn::Tester).to receive(:new).once.and_call_original
    2.times { Devise.zxcvbn_tester }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise_zxcvbn-4.4.1 spec/devise_zxcvbn/devise_zxcbn_spec.rb
devise_zxcvbn-2.1.2 spec/devise_zxcvbn/devise_zxcbn_spec.rb
devise_zxcvbn-2.1.1 spec/devise_zxcvbn/devise_zxcbn_spec.rb
devise_zxcvbn-2.1.0 spec/devise_zxcvbn/devise_zxcbn_spec.rb