frikandel 1.0.0 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,57 +0,0 @@
1
- require "spec_helper"
2
- require "support/application_controller"
3
-
4
- describe ApplicationController do
5
-
6
- it "holds the session for at least .1 seconds" do
7
- get :home
8
- session[:user_id] = 1337
9
- sleep 0.1
10
- get :home
11
-
12
- session[:user_id].should be_present
13
- session[:user_id].should eq 1337
14
- end
15
-
16
- it "destroys the session after SESSION_TTL" do
17
- get :home
18
- session[:user_id] = 2337
19
- request.session[:ttl] = (Frikandel::Configuration.ttl + 1.minute).seconds.ago
20
- get :home
21
-
22
- session[:user_id].should be_blank
23
- end
24
-
25
- it "destroys the session after SESSION_MAX_TTL" do
26
- get :home
27
- session[:user_id] = 3337
28
-
29
- request.session[:max_ttl] = 1.minute.ago
30
- get :home
31
-
32
- session[:user_id].should be_blank
33
- end
34
-
35
- it "works when there was no session in the request" do
36
- get :home
37
- session[:user_id] = 4337
38
- request.session = nil
39
- get :home
40
-
41
- session[:user_id].should be_blank
42
- end
43
-
44
- it "is configurable" do
45
- old_value = Frikandel::Configuration.ttl
46
- Frikandel::Configuration.ttl = 1.minute
47
- get :home
48
- session[:ttl] = 30.minutes.ago
49
- session[:user_id] = 5337
50
-
51
- get :home
52
- session[:user_id].should be_blank
53
-
54
- Frikandel::Configuration.ttl = old_value
55
- end
56
-
57
- end
@@ -1,39 +0,0 @@
1
- require "spec_helper"
2
- require "support/application_controller"
3
-
4
- class SessionExpiredError < StandardError; end
5
-
6
- class CustomizedOnExpiredSessionController < ApplicationController
7
- def on_expired_session
8
- raise SessionExpiredError.new("Your Session is DEAD!")
9
- end
10
- alias my_on_expired_session on_expired_session
11
- end
12
-
13
- describe CustomizedOnExpiredSessionController do
14
-
15
- it "uses the overwritten on_expired_cookie function" do
16
- get :home
17
- request.session[:max_ttl] = 1.minute.ago
18
-
19
- expect { get :home }.to raise_error SessionExpiredError
20
- end
21
-
22
- it "can revert the on_expired_cookie function back to the original" do
23
- # NOTE: Don't confuse original_on_expired_session with my_on_expired_session!
24
- class CustomizedOnExpiredSessionController < ApplicationController
25
- alias on_expired_session original_on_expired_session # Setting it to the Gems original
26
- end
27
-
28
- get :home
29
- request.session[:max_ttl] = 1.minute.ago
30
-
31
- begin
32
- expect { get :home }.to_not raise_error
33
- ensure
34
- class CustomizedOnExpiredSessionController < ApplicationController
35
- alias on_expired_session my_on_expired_session # Reverting it back to the Customized function thats defined in this test
36
- end
37
- end
38
- end
39
- end
File without changes