sessions: add a helper to clear the stored return path
This commit is contained in:
parent
e39fd7b171
commit
e580d336e4
6 changed files with 65 additions and 8 deletions
26
spec/controllers/devise/store_location_extension_spec.rb
Normal file
26
spec/controllers/devise/store_location_extension_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Devise::StoreLocationExtension, type: :controller do
|
||||
class TestController < ActionController::Base
|
||||
include Devise::Controllers::StoreLocation
|
||||
include Devise::StoreLocationExtension
|
||||
end
|
||||
|
||||
controller TestController do
|
||||
end
|
||||
|
||||
describe "#clear_stored_location_for" do
|
||||
context 'when a location has been previously stored' do
|
||||
before { subject.store_location_for(:user, dossiers_path) }
|
||||
|
||||
it 'delete the stored location' do
|
||||
subject.clear_stored_location_for(:user)
|
||||
expect(subject.stored_location_for(:user)).to be nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when no location has been stored' do
|
||||
it { expect(subject.clear_stored_location_for(:user)).to be nil }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue