ateam-merb-auth-old 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,8 @@ module MerbAuth
22
22
  expires = Time.parse(self.current_ma_user.remember_token_expires_at.to_s)
23
23
  cookies[:auth_token] = { :value => self.current_ma_user.remember_token , :expires => expires }
24
24
  end
25
- redirect_back_or_default('/')
25
+ #redirect_back_or_default('/')
26
+ redirect MA[:redirect_after_login] || '/'
26
27
  else
27
28
  render :new
28
29
  end
@@ -31,6 +31,7 @@ describe MA::Sessions, "Index action" do
31
31
  @quentin = User.create(valid_user_hash.with(:email => "quentin@example.com", :password => "test", :password_confirmation => "test"))
32
32
  @controller = MA::Sessions.new(fake_request)
33
33
  @quentin.activate
34
+ MA[:redirect_after_login] = nil
34
35
  end
35
36
 
36
37
  it "should have a route to Sessions#new from '/login'" do
@@ -71,6 +72,12 @@ describe MA::Sessions, "Index action" do
71
72
  controller.session[:user].should == @quentin.id
72
73
  controller.should redirect_to("/")
73
74
  end
75
+
76
+ it 'logins and redirects to profile' do
77
+ MA[:redirect_after_login] = '/profile'
78
+ controller = post "/merb-auth/login", :email => 'quentin@example.com', :password => 'test'
79
+ controller.should redirect_to("/profile")
80
+ end
74
81
 
75
82
  it 'fails login and does not redirect' do
76
83
  controller = post "/merb-auth/login", :email => 'quentin@example.com', :password => 'bad password'
@@ -115,4 +122,4 @@ describe MA::Sessions, "Index action" do
115
122
  def cookie_for(user)
116
123
  auth_token user.remember_token
117
124
  end
118
- end
125
+ end
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ateam