ateam-merb-auth-old 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,9 @@ module MerbAuth
|
|
23
23
|
cookies[:auth_token] = { :value => self.current_ma_user.remember_token , :expires => expires }
|
24
24
|
end
|
25
25
|
#redirect_back_or_default('/')
|
26
|
-
redirect MA[:redirect_after_login] || '/'
|
26
|
+
#redirect MA[:redirect_after_login] || '/'
|
27
|
+
|
28
|
+
redirect_back_or_default(MA[:redirect_after_login] || '/')
|
27
29
|
else
|
28
30
|
render :new
|
29
31
|
end
|
@@ -49,7 +49,7 @@ describe MA::Sessions, "Index action" do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should have a named route :login" do
|
52
|
-
@controller.url(:
|
52
|
+
@controller.url(:merb_auth_login).should == "/merb-auth/login"
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should have route to Sessions#destroy from '/logout' via delete" do
|
@@ -78,6 +78,14 @@ describe MA::Sessions, "Index action" do
|
|
78
78
|
controller = post "/merb-auth/login", :email => 'quentin@example.com', :password => 'test'
|
79
79
|
controller.should redirect_to("/profile")
|
80
80
|
end
|
81
|
+
|
82
|
+
it 'should return to previous uri' do
|
83
|
+
MA[:redirect_after_login] = '/profile'
|
84
|
+
controller = post "/merb-auth/login", :email => 'quentin@example.com', :password => 'test' do |c|
|
85
|
+
c.session[:return_to] = '/login'
|
86
|
+
end
|
87
|
+
controller.should redirect_to("/login")
|
88
|
+
end
|
81
89
|
|
82
90
|
it 'fails login and does not redirect' do
|
83
91
|
controller = post "/merb-auth/login", :email => 'quentin@example.com', :password => 'bad password'
|
@@ -103,7 +111,7 @@ describe MA::Sessions, "Index action" do
|
|
103
111
|
|
104
112
|
it 'deletes token on logout' do
|
105
113
|
controller = get("/merb-auth/logout") {|request| request.stub!(:current_user).and_return(@quentin) }
|
106
|
-
controller.cookies["auth_token"].should
|
114
|
+
controller.cookies["auth_token"].should be_blank
|
107
115
|
end
|
108
116
|
|
109
117
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ateam-merb-auth-old
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ateam
|
@@ -9,7 +9,7 @@ autorequire: name
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|