mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-22 21:28:01 -05:00
Add cancel to registrations controller as a way to delete information from session.
This commit is contained in:
@@ -150,4 +150,16 @@ class RegistrationTest < ActionController::IntegrationTest
|
||||
|
||||
assert User.all.empty?
|
||||
end
|
||||
|
||||
test 'a user should be able to cancel sign up by deleting data in the session' do
|
||||
get "/set"
|
||||
assert_equal "something", @request.session["user_facebook_oauth_token"]
|
||||
|
||||
get "/users/sign_up"
|
||||
assert_equal "something", @request.session["user_facebook_oauth_token"]
|
||||
|
||||
get "/users/cancel"
|
||||
assert_nil @request.session["user_facebook_oauth_token"]
|
||||
assert_redirected_to new_user_registration_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,4 +4,9 @@ class HomeController < ApplicationController
|
||||
|
||||
def private
|
||||
end
|
||||
|
||||
def set
|
||||
session["user_facebook_oauth_token"] = "something"
|
||||
head :ok
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,9 +39,10 @@ Rails.application.routes.draw do
|
||||
:sign_in => "login", :sign_out => "logout",
|
||||
:password => "secret", :confirmation => "verification",
|
||||
:unlock => "unblock", :sign_up => "register",
|
||||
:registration => "management"
|
||||
:registration => "management", :cancel => "giveup"
|
||||
}
|
||||
end
|
||||
|
||||
match "/set", :to => "home#set"
|
||||
root :to => "home#index"
|
||||
end
|
||||
@@ -86,6 +86,11 @@ class DefaultRoutingTest < ActionController::TestCase
|
||||
assert_recognizes({:controller => 'devise/registrations', :action => 'destroy'}, {:path => 'users', :method => :delete})
|
||||
end
|
||||
|
||||
test 'map cancel user registration' do
|
||||
assert_recognizes({:controller => 'devise/registrations', :action => 'cancel'}, {:path => 'users/cancel', :method => :get})
|
||||
assert_named_route "/users/cancel", :cancel_user_registration_path
|
||||
end
|
||||
|
||||
test 'map oauth callbacks' do
|
||||
assert_recognizes({:controller => 'devise/oauth_callbacks', :action => 'facebook'}, {:path => 'users/oauth/facebook/callback', :method => :get})
|
||||
assert_recognizes({:controller => 'devise/oauth_callbacks', :action => 'github'}, {:path => 'users/oauth/github/callback', :method => :get})
|
||||
@@ -140,6 +145,11 @@ class CustomizedRoutingTest < ActionController::TestCase
|
||||
test 'map account with custom path name for registration' do
|
||||
assert_recognizes({:controller => 'devise/registrations', :action => 'new', :locale => 'en'}, '/en/accounts/management/register')
|
||||
end
|
||||
|
||||
test 'map account with custom path name for cancel registration' do
|
||||
assert_recognizes({:controller => 'devise/registrations', :action => 'cancel', :locale => 'en'}, '/en/accounts/management/giveup')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class ScopedRoutingTest < ActionController::TestCase
|
||||
|
||||
Reference in New Issue
Block a user