mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 17:27:09 +02:00
51 lines
1.2 KiB
Ruby
51 lines
1.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe User do
|
|
let(:user) { build(:user) }
|
|
|
|
describe "#valid?" do
|
|
subject { user.valid? }
|
|
|
|
describe "password" do
|
|
before do
|
|
user.current_password = current_password
|
|
user.password = password
|
|
user.password_confirmation = password_confirmation
|
|
end
|
|
|
|
context 'when current_password is correct' do
|
|
let(:current_password) { user.password }
|
|
|
|
context 'when password/confirmation is 8 characters' do
|
|
let(:password) { 'a' * 8 }
|
|
let(:password_confirmation) { password }
|
|
|
|
it { should be_truthy }
|
|
end
|
|
|
|
context 'when password is 7 characters' do
|
|
let(:password) { 'a' * 7 }
|
|
let(:password_confirmation) { password }
|
|
|
|
it { should be_falsey }
|
|
end
|
|
|
|
context 'when password != password_confirmation' do
|
|
let(:password) { 'a' * 8 }
|
|
let(:password_confirmation) { 'b' * 8 }
|
|
|
|
it { should be_falsey }
|
|
end
|
|
end
|
|
|
|
context 'when current_password is wrong' do
|
|
let(:current_password) { 'invalid_password' }
|
|
let(:password) { 'a' * 8 }
|
|
let(:password_confirmation) { password }
|
|
|
|
it { should be_falsey }
|
|
end
|
|
end
|
|
end
|
|
end
|