jeremydurham-restful_authentication 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -8,6 +8,14 @@ authentication:
8
8
  * Account approval / disabling by admin
9
9
  * Rudimentary hooks for authorization and access control.
10
10
 
11
+ This fork significantly updates the plugin to provide:
12
+ * 100% passing specs
13
+ * 100% passing cucumber features (with selenium support)
14
+ * Machinist support
15
+ * Pickle support
16
+ * Available as a gem
17
+ * Uses aasm gem
18
+
11
19
  Several features were updated in May, 2008.
12
20
  * "Stable newer version":http://github.com/technoweenie/restful-authentication/tree/master
13
21
  * "'Classic' (backward-compatible) version":http://github.com/technoweenie/restful-authentication/tree/classic
@@ -7,12 +7,12 @@ Feature: Sign up
7
7
  Given I am not logged in
8
8
  When I am on the home page
9
9
  And I follow "Sign up"
10
- Then I should be on the sign up page
10
+ Then I should be on the signup page
11
11
 
12
12
  Scenario: Create fails when creating an existing <%= file_name %>
13
13
  Given I am not logged in
14
14
  And someone with the login "testing" already exists
15
- When I am on the sign up page
15
+ When I am on the signup page
16
16
  And I fill in "Login" with "testing"
17
17
  And I fill in "Email" with "test@testing.com"
18
18
  And I fill in "Password" with "password"
@@ -23,7 +23,7 @@ Feature: Sign up
23
23
 
24
24
  Scenario: Create fails when given an invalid email
25
25
  Given I am not logged in
26
- When I am on the sign up page
26
+ When I am on the signup page
27
27
  And I fill in "Login" with "testing"
28
28
  And I fill in "Email" with "invalid.email"
29
29
  And I fill in "Password" with "password"
@@ -34,7 +34,7 @@ Feature: Sign up
34
34
 
35
35
  Scenario: Create fails when no password is given
36
36
  Given I am not logged in
37
- When I am on the sign up page
37
+ When I am on the signup page
38
38
  And I fill in "Login" with "testing"
39
39
  And I fill in "Email" with "test@testing.com"
40
40
  And I press "Sign up"
@@ -43,7 +43,7 @@ Feature: Sign up
43
43
 
44
44
  Scenario: Create fails when no password confirmation is given
45
45
  Given I am not logged in
46
- When I am on the sign up page
46
+ When I am on the signup page
47
47
  And I fill in "Login" with "testing"
48
48
  And I fill in "Email" with "test@testing.com"
49
49
  And I fill in "Password" with "password"
@@ -53,11 +53,15 @@ Feature: Sign up
53
53
 
54
54
  Scenario: Create successful when given valid parameters
55
55
  Given I am not logged in
56
- When I am on the sign up page
56
+ When I am on the signup page
57
57
  And I fill in "Login" with "testing"
58
58
  And I fill in "Email" with "test@testing.com"
59
59
  And I fill in "Password" with "password"
60
60
  And I fill in "Confirm Password" with "password"
61
61
  And I press "Sign up"
62
62
  Then I should be on the home page
63
- And I should be logged in
63
+ <% if options[:include_activation] %>
64
+ And I should not be logged in
65
+ <% else %>
66
+ And I should be logged in
67
+ <% end %>
@@ -3,4 +3,11 @@
3
3
  password 'testing'
4
4
  password_confirmation { password }
5
5
  email { Faker::Internet.email }
6
+ <% if options[:include_activation] -%>
7
+ activation_code { nil }
8
+ activated_at { 5.days.ago }
9
+ <% end -%>
10
+ <% if options[:stateful] -%>
11
+ state { 'active' }
12
+ <% end -%>
6
13
  end
@@ -60,12 +60,13 @@ describe <%= model_controller_class_name %>Controller do
60
60
 
61
61
  <% if options[:include_activation] %>
62
62
  it 'activates user' do
63
+ create_<%= file_name %>(:login => 'aaron', :password => 'monkey', :password_confirmation => 'monkey')
63
64
  <%= class_name %>.authenticate('aaron', 'monkey').should be_nil
64
- get :activate, :activation_code => <%= table_name %>(:aaron).activation_code
65
+ get :activate, :activation_code => assigns[:<%= file_name %>].activation_code
65
66
  response.should redirect_to('/login')
66
67
  flash[:notice].should_not be_nil
67
68
  flash[:error ].should be_nil
68
- <%= class_name %>.authenticate('aaron', 'monkey').should == <%= table_name %>(:aaron)
69
+ <%= class_name %>.authenticate('aaron', 'monkey').should == assigns[:<%= file_name %>]
69
70
  end
70
71
 
71
72
  it 'does not activate user without key' do
@@ -9,6 +9,7 @@ module Authorization
9
9
  recipient.class_eval do
10
10
  include StatefulRolesInstanceMethods
11
11
  include AASM
12
+
12
13
  aasm_column :state
13
14
  aasm_initial_state :initial => :pending
14
15
  aasm_state :passive
@@ -7,32 +7,34 @@ module Authorization
7
7
  def self.included( recipient )
8
8
  recipient.extend( StatefulRolesClassMethods )
9
9
  recipient.class_eval do
10
+ include AASM
10
11
  include StatefulRolesInstanceMethods
11
12
 
12
- acts_as_state_machine :initial => :pending
13
- state :passive
14
- state :pending, :enter => :make_activation_code
15
- state :active, :enter => :do_activate
16
- state :suspended
17
- state :deleted, :enter => :do_delete
13
+ aasm_column :state
14
+ aasm_initial_state :pending
15
+ aasm_state :passive
16
+ aasm_state :pending, :enter => :make_activation_code
17
+ aasm_state :active, :enter => :do_activate
18
+ aasm_state :suspended
19
+ aasm_state :deleted, :enter => :do_delete
18
20
 
19
- event :register do
21
+ aasm_event :register do
20
22
  transitions :from => :passive, :to => :pending, :guard => Proc.new {|u| !(u.crypted_password.blank? && u.password.blank?) }
21
23
  end
22
24
 
23
- event :activate do
25
+ aasm_event :activate do
24
26
  transitions :from => :pending, :to => :active
25
27
  end
26
28
 
27
- event :suspend do
29
+ aasm_event :suspend do
28
30
  transitions :from => [:passive, :pending, :active], :to => :suspended
29
31
  end
30
32
 
31
- event :delete do
33
+ aasm_event :delete do
32
34
  transitions :from => [:passive, :pending, :active, :suspended], :to => :deleted
33
35
  end
34
36
 
35
- event :unsuspend do
37
+ aasm_event :unsuspend do
36
38
  transitions :from => :suspended, :to => :active, :guard => Proc.new {|u| !u.activated_at.blank? }
37
39
  transitions :from => :suspended, :to => :pending, :guard => Proc.new {|u| !u.activation_code.blank? }
38
40
  transitions :from => :suspended, :to => :passive
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{jeremydurham-restful_authentication}
5
- s.version = "1.1.4"
5
+ s.version = "1.1.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["RailsJedi", "Rick Olson"]
9
- s.date = %q{2009-11-25}
9
+ s.date = %q{2009-11-30}
10
10
  s.description = %q{This widely-used plugin provides a foundation for securely managing user.}
11
11
  s.email = %q{railsjedi@gmail.com}
12
12
  s.extra_rdoc_files = ["README.textile"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeremydurham-restful_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - RailsJedi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-25 00:00:00 -05:00
13
+ date: 2009-11-30 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency