Merge login and terms screens, assume TOU and contributor terms are accepted on /user/new form
This eliminates the need for "terms" screen after /user/new form.. Terms screen is still required for legacy users who never accepted the terms.
This commit is contained in:
parent
64083f0264
commit
1276fb944a
8 changed files with 156 additions and 427 deletions
|
@ -38,7 +38,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
def test_confirm_get
|
||||
user = build(:user, :pending)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
get user_confirm_path, :params => { :display_name => user.display_name, :confirm_string => confirm_string }
|
||||
|
@ -50,7 +49,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
# Get the confirmation page
|
||||
|
@ -71,7 +69,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
post logout_path
|
||||
|
@ -85,7 +82,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
post user_confirm_path, :params => { :display_name => user.display_name, :confirm_string => confirm_string }
|
||||
|
@ -96,7 +92,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
post logout_path
|
||||
|
@ -111,7 +106,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
post logout_path
|
||||
|
@ -125,7 +119,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
post user_confirm_path, :params => { :display_name => user.display_name, :confirm_string => confirm_string, :referer => new_diary_entry_path }
|
||||
|
@ -136,7 +129,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
post logout_path
|
||||
|
@ -151,7 +143,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
travel 2.weeks do
|
||||
|
@ -165,7 +156,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
post user_confirm_path, :params => { :display_name => user.display_name, :confirm_string => confirm_string, :referer => new_diary_entry_path }
|
||||
|
@ -183,7 +173,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
user = build(:user, :pending)
|
||||
stub_gravatar_request(user.email)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
confirm_string = User.find_by(:email => user.email).generate_token_for(:new_user)
|
||||
|
||||
User.find_by(:display_name => user.display_name).hide!
|
||||
|
@ -201,7 +190,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
def test_confirm_resend_success
|
||||
user = build(:user, :pending)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
|
||||
assert_difference "ActionMailer::Base.deliveries.size", 1 do
|
||||
perform_enqueued_jobs do
|
||||
|
@ -220,25 +208,9 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_confirm_resend_no_token
|
||||
user = build(:user, :pending)
|
||||
# only complete first half of registration
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
get user_confirm_resend_path(user)
|
||||
end
|
||||
end
|
||||
|
||||
assert_redirected_to login_path
|
||||
assert_match "User #{user.display_name} not found.", flash[:error]
|
||||
end
|
||||
|
||||
def test_confirm_resend_deleted
|
||||
user = build(:user, :pending)
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
|
||||
User.find_by(:display_name => user.display_name).hide!
|
||||
|
||||
|
|
|
@ -106,18 +106,10 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
def test_new_success
|
||||
user = build(:user, :pending)
|
||||
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_difference "User.count", 1 do
|
||||
assert_difference "ActionMailer::Base.deliveries.size", 1 do
|
||||
perform_enqueued_jobs do
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -151,55 +143,14 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_select "form > div > input.is-invalid#user_email"
|
||||
end
|
||||
|
||||
def test_save_duplicate_email
|
||||
def test_new_duplicate_email_uppercase
|
||||
user = build(:user, :pending)
|
||||
|
||||
# Set up our user as being half-way through registration
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Now create another user with that email
|
||||
create(:user, :email => user.email)
|
||||
|
||||
# Check that the second half of registration fails
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
assert_template "new"
|
||||
assert_select "form > div > input.is-invalid#user_email"
|
||||
end
|
||||
|
||||
def test_save_duplicate_email_uppercase
|
||||
user = build(:user, :pending)
|
||||
|
||||
# Set up our user as being half-way through registration
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Now create another user with that email, but uppercased
|
||||
create(:user, :email => user.email.upcase)
|
||||
|
||||
# Check that the second half of registration fails
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -209,26 +160,14 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_select "form > div > input.is-invalid#user_email"
|
||||
end
|
||||
|
||||
def test_save_duplicate_name
|
||||
def test_new_duplicate_name
|
||||
user = build(:user, :pending)
|
||||
|
||||
# Set up our user as being half-way through registration
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Now create another user with that display name
|
||||
create(:user, :display_name => user.display_name)
|
||||
|
||||
# Check that the second half of registration fails
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -238,26 +177,14 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_select "form > div > input.is-invalid#user_display_name"
|
||||
end
|
||||
|
||||
def test_save_duplicate_name_uppercase
|
||||
def test_new_duplicate_name_uppercase
|
||||
user = build(:user, :pending)
|
||||
|
||||
# Set up our user as being half-way through registration
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Now create another user with that display_name, but uppercased
|
||||
create(:user, :display_name => user.display_name.upcase)
|
||||
|
||||
# Check that the second half of registration fails
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -267,18 +194,9 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_select "form > div > input.is-invalid#user_display_name"
|
||||
end
|
||||
|
||||
def test_save_blocked_domain
|
||||
def test_new_blocked_domain
|
||||
user = build(:user, :pending, :email => "user@example.net")
|
||||
|
||||
# Set up our user as being half-way through registration
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Now block that domain
|
||||
create(:acl, :domain => "example.net", :k => "no_account_creation")
|
||||
|
||||
|
@ -286,7 +204,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -298,18 +216,9 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
def test_save_referer_params
|
||||
user = build(:user, :pending)
|
||||
|
||||
# Set up our user as being half-way through registration
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes, :referer => "/edit?editor=id#map=1/2/3" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_difference "User.count", 1 do
|
||||
assert_difference "ActionMailer::Base.deliveries.size", 1 do
|
||||
post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
|
||||
post user_new_path, :params => { :user => user.attributes, :referer => "/edit?editor=id#map=1/2/3" }
|
||||
assert_enqueued_with :job => ActionMailer::MailDeliveryJob,
|
||||
:args => proc { |args| args[3][:args][2] == welcome_path(:editor => "id", :zoom => 1, :lat => 2, :lon => 3) }
|
||||
perform_enqueued_jobs
|
||||
|
@ -319,24 +228,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
|||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_terms_new_user
|
||||
user = build(:user, :pending)
|
||||
|
||||
# Set up our user as being half-way through registration
|
||||
assert_no_difference "User.count" do
|
||||
assert_no_difference "ActionMailer::Base.deliveries.size" do
|
||||
perform_enqueued_jobs do
|
||||
post user_new_path, :params => { :user => user.attributes }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
get user_terms_path
|
||||
|
||||
assert_response :success
|
||||
assert_template :terms
|
||||
end
|
||||
|
||||
def test_terms_agreed
|
||||
user = create(:user, :terms_seen => true, :terms_agreed => Date.yesterday)
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => dup_email,
|
||||
:display_name => display_name,
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" } }
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -89,26 +90,18 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
new_email = "newtester@osm.org"
|
||||
display_name = "new_tester"
|
||||
|
||||
assert_difference("User.count", 0) do
|
||||
assert_difference("ActionMailer::Base.deliveries.size", 0) do
|
||||
assert_difference("User.count", 1) do
|
||||
assert_difference("ActionMailer::Base.deliveries.size", 1) do
|
||||
perform_enqueued_jobs do
|
||||
post "/user/new",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_redirected_to "/user/terms"
|
||||
|
||||
assert_difference("User.count") do
|
||||
assert_difference("ActionMailer::Base.deliveries.size", 1) do
|
||||
perform_enqueued_jobs do
|
||||
post "/user/save",
|
||||
:params => { :read_ct => 1, :read_tou => 1 }
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" } }
|
||||
assert_response :redirect
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -138,33 +131,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
assert_equal user, User.authenticate(:username => new_email, :password => "testtest")
|
||||
end
|
||||
|
||||
def test_user_create_no_tou_failure
|
||||
new_email = "#newtester@osm.org"
|
||||
display_name = "new_tester"
|
||||
|
||||
assert_difference("User.count", 0) do
|
||||
assert_difference("ActionMailer::Base.deliveries.size", 0) do
|
||||
perform_enqueued_jobs do
|
||||
post "/user/new",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_redirected_to "/user/terms"
|
||||
|
||||
perform_enqueued_jobs do
|
||||
post "/user/save"
|
||||
assert_redirected_to "/user/terms"
|
||||
end
|
||||
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
# Check that the user can successfully recover their password
|
||||
def test_lost_password_recovery_success
|
||||
# Open the lost password form
|
||||
|
@ -188,16 +154,11 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:pass_crypt_confirmation => password,
|
||||
:consider_pd => "1" },
|
||||
:referer => referer }
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_response(:redirect)
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -247,23 +208,14 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "openid",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password,
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "openid",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_response :redirect
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -290,8 +242,9 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "openid",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new")
|
||||
|
@ -325,23 +278,15 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "openid",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" },
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" },
|
||||
:referer => referer }
|
||||
assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "openid",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -391,22 +336,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "google",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password,
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "google", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "google")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "google",
|
||||
:auth_uid => "123454321",
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_redirected_to welcome_path
|
||||
follow_redirect!
|
||||
end
|
||||
|
@ -434,7 +370,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "google",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt_confirmation => "",
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "google", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "google")
|
||||
|
@ -469,23 +406,15 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "google",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" },
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" },
|
||||
:referer => referer }
|
||||
assert_redirected_to auth_path(:provider => "google", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "google")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "google",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -535,22 +464,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "facebook",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password,
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "facebook", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "facebook")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "facebook",
|
||||
:auth_uid => "123454321",
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_redirected_to welcome_path
|
||||
follow_redirect!
|
||||
end
|
||||
|
@ -578,7 +498,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "facebook",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt_confirmation => "",
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "facebook", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "facebook")
|
||||
|
@ -611,23 +532,15 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "facebook",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" },
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" },
|
||||
:referer => referer }
|
||||
assert_redirected_to auth_path(:provider => "facebook", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "facebook")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "facebook",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -677,22 +590,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "microsoft",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password,
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "microsoft", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "microsoft")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "microsoft",
|
||||
:auth_uid => "123454321",
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_redirected_to welcome_path
|
||||
follow_redirect!
|
||||
end
|
||||
|
@ -720,7 +624,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "microsoft",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt_confirmation => "",
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "microsoft", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "microsoft")
|
||||
|
@ -753,23 +658,15 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "microsoft",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" },
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" },
|
||||
:referer => referer }
|
||||
assert_redirected_to auth_path(:provider => "microsoft", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "microsoft")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "microsoft",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" },
|
||||
:read_ct => 1, :read_tou => 1 }
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -819,23 +716,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "github",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password,
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "github", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "github")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "github",
|
||||
:auth_uid => "123454321",
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:read_ct => 1,
|
||||
:read_tou => 1 }
|
||||
assert_redirected_to welcome_path
|
||||
follow_redirect!
|
||||
end
|
||||
|
@ -863,7 +750,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "github",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt_confirmation => "",
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "github", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "github")
|
||||
|
@ -896,24 +784,15 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "github",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" },
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" },
|
||||
:referer => referer }
|
||||
assert_redirected_to auth_path(:provider => "github", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "github")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "github",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" },
|
||||
:read_ct => 1,
|
||||
:read_tou => 1 }
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
@ -963,23 +842,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "wikipedia",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password,
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "wikipedia", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "wikipedia",
|
||||
:auth_uid => "123454321",
|
||||
:pass_crypt => password,
|
||||
:pass_crypt_confirmation => password },
|
||||
:read_ct => 1,
|
||||
:read_tou => 1 }
|
||||
assert_redirected_to welcome_path
|
||||
follow_redirect!
|
||||
end
|
||||
|
@ -1007,7 +876,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:display_name => display_name,
|
||||
:auth_provider => "wikipedia",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" } }
|
||||
:pass_crypt_confirmation => "",
|
||||
:consider_pd => "1" } }
|
||||
assert_redirected_to auth_path(:provider => "wikipedia", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new")
|
||||
|
@ -1040,24 +910,15 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
|||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "wikipedia",
|
||||
:pass_crypt => "",
|
||||
:pass_crypt_confirmation => "" },
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest",
|
||||
:consider_pd => "1" },
|
||||
:referer => referer }
|
||||
assert_redirected_to auth_path(:provider => "wikipedia", :origin => "/user/new")
|
||||
post response.location
|
||||
assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new")
|
||||
follow_redirect!
|
||||
assert_redirected_to "/user/terms"
|
||||
post "/user/save",
|
||||
:params => { :user => { :email => new_email,
|
||||
:email_confirmation => new_email,
|
||||
:display_name => display_name,
|
||||
:auth_provider => "wikipedia",
|
||||
:auth_uid => "http://localhost:1123/new.tester",
|
||||
:pass_crypt => "testtest",
|
||||
:pass_crypt_confirmation => "testtest" },
|
||||
:read_ct => 1,
|
||||
:read_tou => 1 }
|
||||
assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name
|
||||
follow_redirect!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,10 +13,6 @@ class ConfirmationResendSystemTest < ApplicationSystemTestCase
|
|||
fill_in "Confirm Password", :with => "testtest"
|
||||
click_on "Sign Up"
|
||||
end
|
||||
|
||||
check "I have read and agree to the above contributor terms"
|
||||
check "I have read and agree to the Terms of Use"
|
||||
click_on "Continue"
|
||||
end
|
||||
|
||||
test "flash message should not contain raw html" do
|
||||
|
|
|
@ -8,25 +8,4 @@ class UserSignupTest < ApplicationSystemTestCase
|
|||
|
||||
assert_content "Confirm Password"
|
||||
end
|
||||
|
||||
test "externally redirect when contributor terms declined" do
|
||||
user = build(:user)
|
||||
|
||||
visit root_path
|
||||
click_on "Sign Up"
|
||||
|
||||
within ".new_user" do
|
||||
fill_in "Email", :with => user.email
|
||||
fill_in "Email Confirmation", :with => user.email
|
||||
fill_in "Display Name", :with => user.display_name
|
||||
fill_in "Password", :with => "testtest"
|
||||
fill_in "Confirm Password", :with => "testtest"
|
||||
click_on "Sign Up"
|
||||
end
|
||||
|
||||
assert_content "Contributor terms"
|
||||
click_on "Cancel"
|
||||
|
||||
assert_current_path "https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue