Sha256: f2902228adb060709dc516d023b4729d553531aa97361fc7ed2a3799db5b67a6

Contents?: true

Size: 1.49 KB

Versions: 15

Compression:

Stored size: 1.49 KB

Contents

require "spec_helper"

module Lumberg
  describe Cpanel::PasswordStrength do
    let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
    let(:api_username) { "lumberg" }
    let(:password_strength) do
      described_class.new(
        server:       server,
        api_username: api_username
      )
    end

    let(:weak_password) { "weakness" }
    let(:strong_password) { "0zUIcv-0" }

    describe "#strength" do
      use_vcr_cassette "cpanel/password_strength/strength"

      it "tests a weak password" do
        result = password_strength.strength( password: weak_password )
        result[:params][:data][0][:strength].to_s.should =~ /\A\d+\z/
      end

      it "tests a strong password" do
        result = password_strength.strength( password: strong_password )
        result[:params][:data][0][:strength].to_s.should =~ /\A\d+\z/
      end
    end

    describe "#required_strength" do
      use_vcr_cassette "cpanel/password_strength/required_strength"

      it "gets required password strength for a specific app" do
        result = password_strength.required_strength( app: 'htaccess' )
        result[:params][:data][0][:strength].should be_an(Integer)
      end
    end

    describe "#all_required_strengths" do
      use_vcr_cassette "cpanel/password_strength/all_required_strengths"

      it "gets required password strengths for all apps" do
        result = password_strength.all_required_strengths
        result[:params][:data][0].should be_a(Hash)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lumberg-4.1.0 spec/cpanel/password_strength_spec.rb
lumberg-4.0.0 spec/cpanel/password_strength_spec.rb
lumberg-3.1.0 spec/cpanel/password_strength_spec.rb
lumberg-3.0.0 spec/cpanel/password_strength_spec.rb
lumberg-2.0.1 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre20 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre18 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre15 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre12 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre9 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre8 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre7 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre6 spec/cpanel/password_strength_spec.rb
lumberg-2.0.0.pre5 spec/cpanel/password_strength_spec.rb