ateam-merb-auth-old 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,8 +29,7 @@ module MerbAuth
29
29
  if (!@use_recaptcha || verify_recaptcha(@ivar, :failure_message => nil)) && @ivar.valid?
30
30
  @ivar.save
31
31
  self.current_ma_user = @ivar unless MA[:use_activation]
32
- redirect_back_or_default('/')
33
-
32
+ redirect url(:merb_auth_registered)
34
33
  else
35
34
  render :new
36
35
  end
@@ -42,7 +41,7 @@ module MerbAuth
42
41
  Merb.logger.info "Activated #{current_ma_user}"
43
42
  current_ma_user.activate
44
43
  end
45
- redirect_back_or_default('/')
44
+ redirect url(:merb_auth_activated)
46
45
  end
47
46
 
48
47
  private
data/lib/merb-auth.rb CHANGED
@@ -159,6 +159,8 @@ if defined?(Merb::Plugins)
159
159
  scope.match("/signup").to(:controller => "Users", :action => "new" ).name(:signup)
160
160
  scope.match("/login" ).to(:controller => "sessions", :action => "create" ).name(:login)
161
161
  scope.match("/logout").to(:controller => "sessions", :action => "destroy").name(:logout)
162
+ scope.match("/registered").to(:controller => "users", :action => "registered").name(:registered)
163
+ scope.match("/activated").to(:controller => "users", :action => "activated").name(:activated)
162
164
  end
163
165
 
164
166
  end
@@ -32,19 +32,19 @@ describe MA::Users do
32
32
 
33
33
  it "should provide a current_ma_user method" do
34
34
  MA::Users.new({}).should respond_to(:current_ma_user)
35
- MA::Users.new({}).should respond_to(:current_user)
35
+ MA::Users.new({}).should respond_to(:current_ma_user)
36
36
  end
37
37
 
38
38
  it "should provide a current_user method" do
39
39
  MA::Users.new({}).should respond_to(:current_ma_user=)
40
- MA::Users.new({}).should respond_to(:current_user=)
40
+ MA::Users.new({}).should respond_to(:current_ma_user=)
41
41
  end
42
42
 
43
43
  it 'allows signup' do
44
44
  # lambda do
45
45
  users = User.count
46
46
  controller = create_user
47
- controller.should redirect
47
+ controller.should redirect_to('/merb-auth/registered')
48
48
  User.count.should == (users + 1)
49
49
  # end.should change(User, :count).by(1)
50
50
  end
@@ -86,14 +86,14 @@ describe MA::Users do
86
86
  @user = controller.assigns(:user)
87
87
  User.authenticate('aaron@example.com', 'test').should be_nil
88
88
  controller = get "/merb-auth/users/activate/#{@user.activation_code}"
89
- controller.should redirect_to("/")
89
+ controller.should redirect_to("/merb-auth/activated")
90
90
  User.authenticate('aaron@example.com', 'test').should_not be_nil
91
91
  end
92
92
 
93
93
  it "should log the user in automatically on creation if :use_activation is false" do
94
94
  MA[:use_activation] = false
95
95
  dispatch_to(MA::Users, :create, :user => {:email => "aaron@example.com", :password => "test", :password_confirmation => "test"}) do |c|
96
- u = mock("user")
96
+ u = mock("user", :valid? => true)
97
97
  User.should_receive(:new).and_return(u)
98
98
  u.should_receive(:save).and_return(true)
99
99
  c.should_receive(:current_ma_user=).with(u)
@@ -103,7 +103,7 @@ describe MA::Users do
103
103
  it "should not log the user in automatically on creation if :use_activation is true" do
104
104
  MA[:use_activation] = true
105
105
  dispatch_to(MA::Users, :create, :user => {:email => "aaron@example.com", :password => "test", :password_confirmation => "test"}) do |c|
106
- u = mock("user")
106
+ u = mock("user", :valid? => true)
107
107
  User.should_receive(:new).and_return(u)
108
108
  u.should_receive(:save).and_return(true)
109
109
  c.should_not_receive(:current_ma_user=)
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ateam