usercontroller#test

This commit is contained in:
yanxd 2014-07-28 15:37:10 +08:00
parent bf9a992399
commit f18e828632
3 changed files with 75 additions and 8 deletions

View File

@ -1,11 +1,12 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
act_id:
act_type: MyString
user_id:
id: 1
act_id: 1
act_type: JournalsForMessage
user_id: 5
two:
act_id:
act_type: MyString
user_id:
act_id: 2
act_type: JournalsForMessage
user_id: 5

View File

@ -1,4 +1,34 @@
jfm_001:
id: 1
jour_id: 5
jour_type: Principal
user_id: 2
notes:
status: 0
reply_id: 0
created_on: 2014-07-16 15:27:2
updated_on: 2014-07-16 15:27:2
m_parent_id:
is_readed:
m_reply_count:
m_reply_id:
is_comprehensive_evaluation:
jfm_002:
id: 2
jour_id: 5
jour_type: Principal
user_id: 2
notes: 我觉得这个系统挺实用界面挺简洁美观1
status:
reply_id: 0
created_on: 2014-07-16 15:27:2
updated_on: 2014-07-16 15:27:2
m_parent_id:
is_readed:
m_reply_count:
m_reply_id:
is_comprehensive_evaluation:
jfm_045:
id: 45
jour_id: 2
jour_type: Project
@ -64,7 +94,7 @@ jfm_060:
jour_id: 2
jour_type: Project
user_id: 2
notes: something very nice
notes:
status:
reply_id: 0
created_on: 2013-08-21 07:04:43
@ -119,4 +149,3 @@ jfm_088:
m_reply_count:
m_reply_id:
is_comprehensive_evaluation:

View File

@ -0,0 +1,37 @@
require File.expand_path('../../test_helper', __FILE__)
class UsersControllerTest < ActionController::TestCase
fixtures :users, :projects, :members, :member_roles, :roles,
:custom_fields, :custom_values, :groups_users,
:auth_sources,
:activities,
:journals_for_messages
def setup
User.current = nil
@request.session[:user_id] = 1
@request.session[:ctime] = Time.now
@request.session[:atime] = Time.now
end
test '#index by non-member' do
@request.session[:user_id] = nil
get :index
assert_response :success
assert_template 'index'
end
test '#show by non-member' do
@request.session[:user_id] = 8
get :show, {id: 5}
assert_response :success
assert_template 'show'
end
test '#user_newfeedback by non-member' do
@request.session[:user_id] = nil
get :user_newfeedback, {id: 5}
assert_response :success
assert_template 'user_newfeedback'
end
end