-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* started with test * fix status on creation * Update user.rb * Update user_test.rb * Update user.rb
- Loading branch information
1 parent
4fa3343
commit 3e6ce6b
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,32 @@ class UserTest < ActiveSupport::TestCase | |
assert_equal user.tagnames, user.tagnames | ||
end | ||
|
||
test 'user creation with create_with_omniauth' do | ||
auth = { | ||
'info' => { | ||
'email' => '[email protected]' # there should not already be a username like this | ||
}, | ||
'provider' => 'github' | ||
} | ||
user = User.create_with_omniauth(auth) | ||
assert_equal 1, user.status | ||
assert_equal 'bobafett', user.username | ||
assert_equal 2, user.password_checker | ||
end | ||
|
||
test 'user with duplicate username creation with create_with_omniauth' do | ||
auth = { | ||
'info' => { | ||
'email' => '[email protected]' # there should already be a bob user | ||
}, | ||
'provider' => 'facebook' | ||
} | ||
user = User.create_with_omniauth(auth) | ||
assert_equal 1, user.status | ||
assert_not_equal 'bob', user.username | ||
assert_equal 1, user.password_checker | ||
end | ||
|
||
test 'user mysql native fulltext search' do | ||
assert User.count > 0 | ||
if ActiveRecord::Base.connection.adapter_name == 'Mysql2' | ||
|