Skip to content

Commit

Permalink
Tests for not displaying uid
Browse files Browse the repository at this point in the history
  • Loading branch information
SidharthBansal committed Jul 25, 2018
1 parent 5574837 commit 5977975
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions test/functional/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,57 @@ def setup
post :test_digest_email
assert_redirected_to '/'
end

test 'Oauth tags are in form of oauth:provider for github' do
UserSession.create(users(:jeff))
user = users(:jeff)
auth = { "provider" => "github", "uid" => "123456789"}
uid = user.id
identity = UserTag.create_with_omniauth(auth, uid)
get :profile
assert_response :redirect
assert_redirected_to '/profile/jeff'
s = "div#tag_"+identity.id.to_s
assert_select s,'omniauth:github'
end

test 'Oauth tags are in form of oauth:provider for twitter' do
UserSession.create(users(:jeff))
user = users(:jeff)
auth = { "provider" => "twitter", "uid" => "123456789"}
uid = user.id
identity = UserTag.create_with_omniauth(auth, uid)
get :profile
assert_response :redirect
assert_redirected_to '/profile/jeff'
s = "div#tag_"+identity.id.to_s
assert_select s, 'oauth:twitter'
end

test 'Oauth tags are in form of oauth:provider for google' do
UserSession.create(users(:jeff))
user = users(:jeff)
auth = { "provider" => "google_oauth2", "uid" => "123456789"}
uid = user.id
identity = UserTag.create_with_omniauth(auth, uid)
get :profile
assert_response :redirect
assert_redirected_to '/profile/jeff'
s = "div#tag_"+identity.id.to_s
assert_select s, 'oauth:google_oauth2'
end

test 'Oauth tags are in form of oauth:provider for facebook' do
UserSession.create(users(:jeff))
user = users(:jeff)
auth = { "provider" => "facebook", "uid" => "123456789"}
uid = user.id
identity = UserTag.create_with_omniauth(auth, uid)
get :profile
assert_response :redirect
assert_redirected_to '/profile/jeff'
s = "div#tag_"+identity.id.to_s
assert_select s, 'oauth:facebook'
end

end

0 comments on commit 5977975

Please sign in to comment.