Sha256: c225d65590283ae97eb77cd459c7cb4599709b1a5cefa9cc8baa432611aa46e9
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require "spec_helper" require "support/application_controller" class SessionExpiredError < StandardError; end class CustomizedOnExpiredSessionController < ApplicationController def on_expired_session raise SessionExpiredError.new("Your Session is DEAD!") end alias my_on_expired_session on_expired_session end describe CustomizedOnExpiredSessionController do it "uses the overwritten on_expired_cookie function" do get :home request.session[:max_ttl] = 1.minute.ago expect { get :home }.to raise_error SessionExpiredError end it "can revert the on_expired_cookie function back to the original" do # NOTE: Don't confuse original_on_expired_session with my_on_expired_session! class CustomizedOnExpiredSessionController < ApplicationController alias on_expired_session original_on_expired_session # Setting it to the Gems original end get :home request.session[:max_ttl] = 1.minute.ago begin expect { get :home }.to_not raise_error ensure class CustomizedOnExpiredSessionController < ApplicationController alias on_expired_session my_on_expired_session # Reverting it back to the Customized function thats defined in this test end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
frikandel-1.0.0 | spec/controllers/customized_on_expired_cookie_controller_spec.rb |