+# -*- encoding: utf-8 -*-
+#ユーザアカウント
require 'spec_helper'
describe User do
- pending "add some examples to (or delete) #{__FILE__}"
+ before do
+ @admin = FactoryGirl.create :admin
+ end
+
+ describe 'トークン作成に於いて' do
+ before do
+ @user = FactoryGirl.create( :user_yas)
+ end
+ it 'トークンが変更されている' do
+ lambda {
+ @user.create_token
+ }.should change(@user, :authentication_token)
+ end
+ it 'トークンが作成されている' do
+ @user.create_token
+ @user.authentication_token.should_not be_empty
+ end
+ end
+
+ describe 'トークン削除に於いて' do
+ before do
+ @user = FactoryGirl.create( :user_yas)
+ @user.create_token
+ end
+ it 'トークンが変更されている' do
+ lambda {
+ @user.delete_token
+ }.should change(@user, :authentication_token)
+ end
+ it 'トークンが削除されている' do
+ @user.delete_token
+ @user.authentication_token.should be_blank
+ end
+ end
end