1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #17792 from rockrep/master

allow 'all' for :domain option in addition to :all
This commit is contained in:
Rafael Mendonça França 2014-12-04 15:21:47 -02:00
commit dfa45ce7e1
2 changed files with 11 additions and 1 deletions

View file

@ -283,7 +283,7 @@ module ActionDispatch
def handle_options(options) #:nodoc: def handle_options(options) #:nodoc:
options[:path] ||= "/" options[:path] ||= "/"
if options[:domain] == :all if options[:domain].respond_to?(:to_sym) && options[:domain].to_sym == :all
# if there is a provided tld length then we use it otherwise default domain regexp # if there is a provided tld length then we use it otherwise default domain regexp
domain_regexp = options[:tld_length] ? /([^.]+\.?){#{options[:tld_length]}}$/ : DOMAIN_REGEXP domain_regexp = options[:tld_length] ? /([^.]+\.?){#{options[:tld_length]}}$/ : DOMAIN_REGEXP

View file

@ -145,11 +145,21 @@ class CookiesTest < ActionController::TestCase
head :ok head :ok
end end
def set_cookie_with_domain_all_as_string
cookies[:user_name] = {:value => "rizwanreza", :domain => 'all'}
head :ok
end
def delete_cookie_with_domain def delete_cookie_with_domain
cookies.delete(:user_name, :domain => :all) cookies.delete(:user_name, :domain => :all)
head :ok head :ok
end end
def delete_cookie_with_domain_all_as_string
cookies.delete(:user_name, :domain => 'all')
head :ok
end
def set_cookie_with_domain_and_tld def set_cookie_with_domain_and_tld
cookies[:user_name] = {:value => "rizwanreza", :domain => :all, :tld_length => 2} cookies[:user_name] = {:value => "rizwanreza", :domain => :all, :tld_length => 2}
head :ok head :ok