2016-01-19 16:12:03 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
RSpec.describe Identity do
|
2016-01-19 16:12:03 +05:30
|
|
|
describe 'relations' do
|
|
|
|
it { is_expected.to belong_to(:user) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'fields' do
|
|
|
|
it { is_expected.to respond_to(:provider) }
|
|
|
|
it { is_expected.to respond_to(:extern_uid) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#is_ldap?' do
|
|
|
|
let(:ldap_identity) { create(:identity, provider: 'ldapmain') }
|
|
|
|
let(:other_identity) { create(:identity, provider: 'twitter') }
|
|
|
|
|
|
|
|
it 'returns true if it is a ldap identity' do
|
|
|
|
expect(ldap_identity.ldap?).to be_truthy
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false if it is not a ldap identity' do
|
|
|
|
expect(other_identity.ldap?).to be_falsey
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|