Skip to content

Commit

Permalink
Fix passing of format option to devise_for call.
Browse files Browse the repository at this point in the history
  • Loading branch information
nashby committed Nov 25, 2024
1 parent 7eccc91 commit 46c2c39
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
3 changes: 1 addition & 2 deletions lib/devise/rails/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ def devise_for(*resources)
options[:constraints] = (@scope[:constraints] || {}).merge(options[:constraints] || {})
options[:defaults] = (@scope[:defaults] || {}).merge(options[:defaults] || {})
options[:options] = @scope[:options] || {}
options[:options][:format] = false if options[:format] == false

resources.map!(&:to_sym)

Expand Down Expand Up @@ -462,7 +461,7 @@ def with_devise_exclusive_scope(new_path, new_as, options) #:nodoc:
current_scope = @scope.dup

exclusive = { as: new_as, path: new_path, module: nil }
exclusive.merge!(options.slice(:constraints, :defaults, :options))
exclusive.merge!(options.slice(:constraints, :format, :defaults, :options))

if @scope.respond_to? :new
@scope = @scope.new exclusive
Expand Down
5 changes: 0 additions & 5 deletions test/routes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ class CustomizedRoutingTest < ActionController::TestCase

test 'map with format false for sessions' do
expected_params = {controller: 'devise/sessions', action: 'new'}
expected_params[:format] = false

assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_in', method: :get})
assert_raise ExpectedRoutingError do
Expand All @@ -215,7 +214,6 @@ class CustomizedRoutingTest < ActionController::TestCase

test 'map with format false for passwords' do
expected_params = {controller: 'devise/passwords', action: 'create'}
expected_params[:format] = false

assert_recognizes(expected_params, {path: '/htmlonly_admin/password', method: :post})
assert_raise ExpectedRoutingError do
Expand All @@ -225,7 +223,6 @@ class CustomizedRoutingTest < ActionController::TestCase

test 'map with format false for registrations' do
expected_params = {controller: 'devise/registrations', action: 'new'}
expected_params[:format] = false

assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_up', method: :get})
assert_raise ExpectedRoutingError do
Expand All @@ -235,7 +232,6 @@ class CustomizedRoutingTest < ActionController::TestCase

test 'map with format false for confirmations' do
expected_params = {controller: 'devise/confirmations', action: 'show'}
expected_params[:format] = false

assert_recognizes(expected_params, {path: '/htmlonly_users/confirmation', method: :get})
assert_raise ExpectedRoutingError do
Expand All @@ -245,7 +241,6 @@ class CustomizedRoutingTest < ActionController::TestCase

test 'map with format false for unlocks' do
expected_params = {controller: 'devise/unlocks', action: 'show'}
expected_params[:format] = false

assert_recognizes(expected_params, {path: '/htmlonly_users/unlock', method: :get})
assert_raise ExpectedRoutingError do
Expand Down

0 comments on commit 46c2c39

Please sign in to comment.