Sha256: 2671347dc9c6bab37a430b1386910eb355df22bf0dbab1b383aa7f72ef6e9f99
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
# encoding: utf-8 require 'spec_helper' describe User do context '.create' do it 'requires a name and a password' do expect { create(:user, name: 'name', password: 'password', ) }.not_to raise_error end it 'fails on missing name' do expect { create(:user, name: nil, password: 'password', ) }.to raise_error end it 'fails on missing password' do expect { create(:user, name: 'user1', password: nil, ) }.to raise_error end end context '.find_by!' do it 'finds a user' do create :user expect { User.find_by!(name: 'user') }.not_to raise_error end end context '.load_from' do it 'creates users from source' do source = double('source') expect(source).to receive(:create_users).with(User) User.load_from source end end context '#to_login' do it 'returns the user as textual representation in cleartext' do user = create(:user, name: 'name', password: 'password', ) expect(user.to_login(cleartext: true)).to eq('name:password') end it 'returns the user as textual representation without password' do user = create(:user, name: 'name', password: 'password', ) expect(user.to_login).to eq('name:\*\*\*\*') end end context '#to_string' do it 'returns the user as textual representation in cleartext' do user = create(:user, name: 'name', password: 'password', ) expect(user.to_string).to eq('name') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
proxy_tester-0.1.10 | spec/user_spec.rb |