2013-06-26 07:57:53 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Token do
|
|
|
|
before { stub_symlink_methods }
|
|
|
|
|
|
|
|
describe 'platform token' do
|
|
|
|
let!(:platform_token) { FactoryGirl.create(:platform_token) }
|
|
|
|
|
|
|
|
context 'ensures that validations and associations exist' do
|
|
|
|
it { should belong_to(:subject) }
|
|
|
|
it { should belong_to(:creator) }
|
|
|
|
|
|
|
|
it { should validate_presence_of(:creator_id) }
|
|
|
|
it { should validate_presence_of(:subject_id) }
|
|
|
|
it { should validate_presence_of(:subject_type) }
|
|
|
|
|
|
|
|
it 'ensures that authentication_token unique' do
|
|
|
|
token = FactoryGirl.create(:platform_token)
|
|
|
|
token.authentication_token = platform_token.authentication_token
|
2015-02-19 01:12:08 +00:00
|
|
|
token.valid?.should be_falsy
|
2013-06-26 07:57:53 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|