Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhkonkov committed Mar 16, 2017
1 parent 4c39c03 commit b20f4e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion test/controllers/web/admin/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class Web::Admin::UsersControllerTest < ActionController::TestCase
setup do
@user = create :user, neem: false
@user_attrs = attributes_for :user
admin_http_login
end

Expand All @@ -15,9 +17,23 @@ class Web::Admin::UsersControllerTest < ActionController::TestCase
assert_response :success
end

test 'create' do
user_count = User.count
post :create, params: { user: @user_attrs }
assert_response :redirect
assert { User.count == user_count + 1 }
end

test 'edit' do
get :edit
get :edit, params: { id: @user.id }
assert_response :success
end

test 'update' do
new_email = '[email protected]'
put :update, params: { id: @user.id,
user: { email: new_email } }
assert { @user.reload.email = new_email }
end

end
2 changes: 1 addition & 1 deletion test/factories/users.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FactoryGirl.define do
factory :user do
name
email
email '[email protected]'
description
end
end

0 comments on commit b20f4e6

Please sign in to comment.