+ assert_template "site/welcome"
+
+ ActionMailer::Base.deliveries.clear
+ end
+
+ def test_user_create_github_duplicate_email
+ dup_user = create(:user)
+ display_name = "new_tester-github"
+ auth_uid = "123454321"
+
+ OmniAuth.config.add_mock(:github,
+ :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 => "github", :origin => "/user/new")
+ assert_redirected_to auth_success_path(:provider => "github")
+ 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 => "github", :auth_uid => auth_uid
+ follow_redirect!
+
+ assert_response :success
+ assert_template "users/new"
+ assert_select "form > div > input.is-invalid#user_email"