Sha256: 37c7208cc524f7fe322b46cbd225a3a9fa46ad1b59a47b8dc59624998278e378

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

describe Kankri::PasswordCheck do
  let(:passwords) { { test: 'hunter2' } }
  subject { ->(u, p) { Kankri::PasswordCheck.new(u, p, passwords) } }

  describe '#ok?' do
    context 'with a valid username and password' do
      specify { expect(subject.call(:test, 'hunter2').ok?).to be_true }
    end
    context 'with a valid username and invalid password' do
      specify { expect(subject.call(:test, 'nope').ok?).to be_false }
    end
    context 'with an invalid username and password' do
      specify { expect(subject.call(:toast, 'nope').ok?).to be_false }
    end
    context 'with a valid username and blank password' do
      specify { expect(subject.call(:test, '').ok?).to be_false }
    end
    context 'with a blank username and password' do
      specify { expect(subject.call(:'', '').ok?).to be_false }
    end
    context 'with a valid username and nil password' do
      specify { expect(subject.call(:test, nil).ok?).to be_false }
    end
    context 'with a nil username and password' do
      specify { expect(subject.call(nil, nil).ok?).to be_false }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kankri-0.1.2 spec/password_check_spec.rb
kankri-0.1.1 spec/password_check_spec.rb
kankri-0.1.0 spec/password_check_spec.rb