diff options
author | jessib <jessib@leap.se> | 2013-01-10 11:06:09 -0800 |
---|---|---|
committer | jessib <jessib@leap.se> | 2013-01-10 11:06:09 -0800 |
commit | d81bf00ecd8bdfcddf50e4881428c917253326fe (patch) | |
tree | 87b713867f26761316e557753e67da403cd592c9 /users/test | |
parent | 2599c7bac06ee55d58e492a47e09ee163e9582ba (diff) |
Add test for showing user.
Diffstat (limited to 'users/test')
-rw-r--r-- | users/test/functional/users_controller_test.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/users/test/functional/users_controller_test.rb b/users/test/functional/users_controller_test.rb index 1fa1462..1f6c868 100644 --- a/users/test/functional/users_controller_test.rb +++ b/users/test/functional/users_controller_test.rb @@ -9,12 +9,31 @@ class UsersControllerTest < ActionController::TestCase assert_response :success end + test "failed show without login" do + user = find_record User + get :show, :id => user.id + assert_response :redirect + assert_redirected_to login_path + end + + test "user can see user" do + user = find_record User, + :email => nil, + :email_forward => nil, + :email_aliases => [], + :created_at => Time.now, + :updated_at => Time.now, + :most_recent_tickets => [] + login user + get :show, :id => user.id + assert_response :success + end + test "should create new user" do user = stub_record User User.expects(:create).with(user.params).returns(user) post :create, :user => user.params, :format => :json - assert_nil session[:user_id] assert_json_response user assert_response :success |