Allow nil HTTP user agent
This commit is contained in:
parent
d44300c7a2
commit
2d44107b5d
2 changed files with 8 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ class ApplicationController < ActionController::Base
|
||||||
def after_sign_out_path_for(resource_or_scope)
|
def after_sign_out_path_for(resource_or_scope)
|
||||||
# mobile_fu's is_mobile_device? wasn't working here for some reason...
|
# mobile_fu's is_mobile_device? wasn't working here for some reason...
|
||||||
# it may have been just because of the test env.
|
# it may have been just because of the test env.
|
||||||
if request.env['HTTP_USER_AGENT'].match(/mobile/i)
|
if request.env['HTTP_USER_AGENT'].try(:match, /mobile/i)
|
||||||
root_path
|
root_path
|
||||||
else
|
else
|
||||||
new_user_session_path
|
new_user_session_path
|
||||||
|
|
|
||||||
|
|
@ -91,4 +91,11 @@ describe ApplicationController, :type => :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#after_sign_out_path_for" do
|
||||||
|
it "can handle a nil HTTP_USER_AGENT" do
|
||||||
|
@request.headers["HTTP_USER_AGENT"] = nil
|
||||||
|
expect(@controller.send(:after_sign_out_path_for, alice)).to eq(new_user_session_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue