OSDN Git Service

add: social button
[pettanr/pettanr.git] / spec / models / user_spec.rb
1 # -*- encoding: utf-8 -*-
2 #ユーザアカウント
3 require 'spec_helper'
4
5 describe User do
6   before do
7     @admin = FactoryGirl.create :admin
8   end
9
10   describe 'トークン作成に於いて' do
11     before do
12       @user = FactoryGirl.create( :user_yas)
13     end
14     it 'トークンが変更されている' do
15       lambda {
16         @user.create_token
17       }.should change(@user, :authentication_token)
18     end
19     it 'トークンが作成されている' do
20       @user.create_token
21       @user.authentication_token.should_not be_empty
22     end
23   end
24   
25   describe 'トークン削除に於いて' do
26     before do
27       @user = FactoryGirl.create( :user_yas)
28       @user.create_token
29     end
30     it 'トークンが変更されている' do
31       lambda {
32         @user.delete_token
33       }.should change(@user, :authentication_token)
34     end
35     it 'トークンが削除されている' do
36       @user.delete_token
37       @user.authentication_token.should be_blank
38     end
39   end
40 end