Sha256: b9ccd6eb8666d30d361af6c6ba709d14b33bf66ea9fe6d70ebefa76db64a706f
Contents?: true
Size: 1.49 KB
Versions: 5
Compression:
Stored size: 1.49 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_s' 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 end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
proxy_tester-0.1.8 | spec/user_spec.rb |
proxy_tester-0.1.6 | spec/user_spec.rb |
proxy_tester-0.1.5 | spec/user_spec.rb |
proxy_tester-0.1.4 | spec/user_spec.rb |
proxy_tester-0.1.3 | spec/user_spec.rb |