Sha256: 2f48f328386d222900edbf7a5c2a389e0b29e0233740c4621f56cc5d27f779bc
Contents?: true
Size: 1.48 KB
Versions: 11
Compression:
Stored size: 1.48 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_string(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_string).to eq('name:****') end end end
Version data entries
11 entries across 11 versions & 1 rubygems