Devise sign_out not working in test - can still access after sign_out, no redirectNo route matches “/users/sign_out” devise rails 3Devise+CanCan AccessDenied redirect differs between dev and test environmentsRail Devise creat own sign_in and sign_out actionsunable to use sign_out in ruby on rails devise gemDevise keeps going into an infinite loop on the sign_in pathRuby on Rails: How can I sign in with devise inside of my tests?Rails Devise confirmable don't redirect to confirmationsHow do I log in a user with Devise for Rails controller/integration unit tests?Devise 401 unauthorized only when the application is accessed over httpsDevise+Oauth - current_user nil after redirect for first sign in only

How are mathematicians paid to do research?

How can I truly shut down ssh server?

LED glows slightly during soldering

What happens to unproductive professors?

How would vampires avoid contracting diseases?

Should disabled buttons give feedback when clicked?

What is a "shilicashe?"

Are there any medieval light sources without fire?

Is "I do not want you to go nowhere" a case of "DOUBLE-NEGATIVES" as claimed by Grammarly?

Does throwing a penny at a train stop the train?

Sharing shapefile collection

How to drill holes in 3/8" thick steel plates?

If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?

Word meaning to destroy books

How can a dictatorship government be beneficial to a dictator in a post-scarcity society?

What steps should I take to lawfully visit the United States as a tourist immediately after visiting on a B-1 visa?

When I press the space bar it deletes the letters after it

Is it possible to create a craft with specific bones, like the bones of a forgotten beast?

Swapping "Good" and "Bad"

Employers keep telling me my college isn't good enough - is there any way to fix this?

Is anyone advocating the promotion of homosexuality in UK schools?

Astronaut distance from Earth?

Why isn't pressure filtration popular compared to vacuum filtration?

Optimization terminology: "Exact" v. "Approximate"



Devise sign_out not working in test - can still access after sign_out, no redirect


No route matches “/users/sign_out” devise rails 3Devise+CanCan AccessDenied redirect differs between dev and test environmentsRail Devise creat own sign_in and sign_out actionsunable to use sign_out in ruby on rails devise gemDevise keeps going into an infinite loop on the sign_in pathRuby on Rails: How can I sign in with devise inside of my tests?Rails Devise confirmable don't redirect to confirmationsHow do I log in a user with Devise for Rails controller/integration unit tests?Devise 401 unauthorized only when the application is accessed over httpsDevise+Oauth - current_user nil after redirect for first sign in only






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















This is my controller with devise:



class UsersController < ApplicationController

before_action :authenticate_user!, only: [:mypage]


and route:



 get "/mypage", to: "users#mypage"


Now I want to test sign-in and sign-out. My test is:



class RorIntegrationTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

test "sign_in then sign_out" do
get "/mypage"
user = users(:someuser)
assert_response :redirect

sign_in(user)
get "/mypage"
assert_response :success

sign_out(user)
get "/mypage"
assert_response :redirect # this is line 17
end


but the result is:



Failure:
RorIntegrationTest#test_sign_in_then_sign_out [/ror/test/integration/ror_integration_test.rb:17]:
Expected response to be a <3XX: redirect>, but was a <200: OK>

bin/rails test test/integration/ror_integration_test.rb:6


It seems that the first get "/mypage" is correctly redirected, but why is the second not redirected after sign_out?










share|improve this question
























  • What is your sign_out method? Could you show the code?

    – Jeremie
    Mar 26 at 6:06











  • @Jeremie They're devise official, from Devise::Test::IntegrationHelpers.

    – akai
    Mar 26 at 6:53











  • put "binding.pry", and check "controller.send(:current_user)" if it's present. Maybe session needs to be cleared. Check also test.log

    – Igor Kasyanchuk
    Mar 26 at 8:28











  • Sorry, I'm back. Can we try something if you have done so before. Can you remove the line 15 to 17 and see if the test passes?

    – Jeremie
    Mar 26 at 14:05

















0















This is my controller with devise:



class UsersController < ApplicationController

before_action :authenticate_user!, only: [:mypage]


and route:



 get "/mypage", to: "users#mypage"


Now I want to test sign-in and sign-out. My test is:



class RorIntegrationTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

test "sign_in then sign_out" do
get "/mypage"
user = users(:someuser)
assert_response :redirect

sign_in(user)
get "/mypage"
assert_response :success

sign_out(user)
get "/mypage"
assert_response :redirect # this is line 17
end


but the result is:



Failure:
RorIntegrationTest#test_sign_in_then_sign_out [/ror/test/integration/ror_integration_test.rb:17]:
Expected response to be a <3XX: redirect>, but was a <200: OK>

bin/rails test test/integration/ror_integration_test.rb:6


It seems that the first get "/mypage" is correctly redirected, but why is the second not redirected after sign_out?










share|improve this question
























  • What is your sign_out method? Could you show the code?

    – Jeremie
    Mar 26 at 6:06











  • @Jeremie They're devise official, from Devise::Test::IntegrationHelpers.

    – akai
    Mar 26 at 6:53











  • put "binding.pry", and check "controller.send(:current_user)" if it's present. Maybe session needs to be cleared. Check also test.log

    – Igor Kasyanchuk
    Mar 26 at 8:28











  • Sorry, I'm back. Can we try something if you have done so before. Can you remove the line 15 to 17 and see if the test passes?

    – Jeremie
    Mar 26 at 14:05













0












0








0








This is my controller with devise:



class UsersController < ApplicationController

before_action :authenticate_user!, only: [:mypage]


and route:



 get "/mypage", to: "users#mypage"


Now I want to test sign-in and sign-out. My test is:



class RorIntegrationTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

test "sign_in then sign_out" do
get "/mypage"
user = users(:someuser)
assert_response :redirect

sign_in(user)
get "/mypage"
assert_response :success

sign_out(user)
get "/mypage"
assert_response :redirect # this is line 17
end


but the result is:



Failure:
RorIntegrationTest#test_sign_in_then_sign_out [/ror/test/integration/ror_integration_test.rb:17]:
Expected response to be a <3XX: redirect>, but was a <200: OK>

bin/rails test test/integration/ror_integration_test.rb:6


It seems that the first get "/mypage" is correctly redirected, but why is the second not redirected after sign_out?










share|improve this question
















This is my controller with devise:



class UsersController < ApplicationController

before_action :authenticate_user!, only: [:mypage]


and route:



 get "/mypage", to: "users#mypage"


Now I want to test sign-in and sign-out. My test is:



class RorIntegrationTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

test "sign_in then sign_out" do
get "/mypage"
user = users(:someuser)
assert_response :redirect

sign_in(user)
get "/mypage"
assert_response :success

sign_out(user)
get "/mypage"
assert_response :redirect # this is line 17
end


but the result is:



Failure:
RorIntegrationTest#test_sign_in_then_sign_out [/ror/test/integration/ror_integration_test.rb:17]:
Expected response to be a <3XX: redirect>, but was a <200: OK>

bin/rails test test/integration/ror_integration_test.rb:6


It seems that the first get "/mypage" is correctly redirected, but why is the second not redirected after sign_out?







ruby-on-rails devise ruby-on-rails-5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 1:42







akai

















asked Mar 26 at 1:33









akaiakai

5322 gold badges6 silver badges30 bronze badges




5322 gold badges6 silver badges30 bronze badges












  • What is your sign_out method? Could you show the code?

    – Jeremie
    Mar 26 at 6:06











  • @Jeremie They're devise official, from Devise::Test::IntegrationHelpers.

    – akai
    Mar 26 at 6:53











  • put "binding.pry", and check "controller.send(:current_user)" if it's present. Maybe session needs to be cleared. Check also test.log

    – Igor Kasyanchuk
    Mar 26 at 8:28











  • Sorry, I'm back. Can we try something if you have done so before. Can you remove the line 15 to 17 and see if the test passes?

    – Jeremie
    Mar 26 at 14:05

















  • What is your sign_out method? Could you show the code?

    – Jeremie
    Mar 26 at 6:06











  • @Jeremie They're devise official, from Devise::Test::IntegrationHelpers.

    – akai
    Mar 26 at 6:53











  • put "binding.pry", and check "controller.send(:current_user)" if it's present. Maybe session needs to be cleared. Check also test.log

    – Igor Kasyanchuk
    Mar 26 at 8:28











  • Sorry, I'm back. Can we try something if you have done so before. Can you remove the line 15 to 17 and see if the test passes?

    – Jeremie
    Mar 26 at 14:05
















What is your sign_out method? Could you show the code?

– Jeremie
Mar 26 at 6:06





What is your sign_out method? Could you show the code?

– Jeremie
Mar 26 at 6:06













@Jeremie They're devise official, from Devise::Test::IntegrationHelpers.

– akai
Mar 26 at 6:53





@Jeremie They're devise official, from Devise::Test::IntegrationHelpers.

– akai
Mar 26 at 6:53













put "binding.pry", and check "controller.send(:current_user)" if it's present. Maybe session needs to be cleared. Check also test.log

– Igor Kasyanchuk
Mar 26 at 8:28





put "binding.pry", and check "controller.send(:current_user)" if it's present. Maybe session needs to be cleared. Check also test.log

– Igor Kasyanchuk
Mar 26 at 8:28













Sorry, I'm back. Can we try something if you have done so before. Can you remove the line 15 to 17 and see if the test passes?

– Jeremie
Mar 26 at 14:05





Sorry, I'm back. Can we try something if you have done so before. Can you remove the line 15 to 17 and see if the test passes?

– Jeremie
Mar 26 at 14:05












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348646%2fdevise-sign-out-not-working-in-test-can-still-access-after-sign-out-no-redire%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348646%2fdevise-sign-out-not-working-in-test-can-still-access-after-sign-out-no-redire%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현