+ def test_user_create_google_duplicate_email
+ dup_user = create(:user)
+ display_name = "new_tester-google"
+ auth_uid = "123454321"
+
+ OmniAuth.config.add_mock(:google,
+ :uid => auth_uid,
+ :extra => { :id_info => { :openid_id => "http://localhost:1123/new.tester" } },
+ :info => { :email => dup_user.email, :name => display_name })
+
+ post auth_path(:provider => "google", :origin => "/user/new")
+ assert_redirected_to auth_success_path(:provider => "google")
+ follow_redirect!
+ assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, :email => dup_user.email,
+ :email_hmac => UsersController.message_hmac(dup_user.email),
+ :auth_provider => "google", :auth_uid => auth_uid
+ follow_redirect!
+
+ assert_response :success
+ assert_template "users/new"
+ assert_select "form > div > input.is-invalid#user_email"
+
+ ActionMailer::Base.deliveries.clear
+ end
+