sorcery 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sorcery might be problematic. Click here for more details.

Files changed (65) hide show
  1. data/Gemfile +4 -2
  2. data/Gemfile.lock +16 -13
  3. data/README.rdoc +28 -27
  4. data/Rakefile +5 -0
  5. data/VERSION +1 -1
  6. data/lib/sorcery.rb +12 -0
  7. data/lib/sorcery/controller.rb +29 -17
  8. data/lib/sorcery/controller/submodules/activity_logging.rb +20 -7
  9. data/lib/sorcery/controller/submodules/brute_force_protection.rb +9 -2
  10. data/lib/sorcery/controller/submodules/http_basic_auth.rb +8 -3
  11. data/lib/sorcery/controller/submodules/oauth.rb +95 -0
  12. data/lib/sorcery/controller/submodules/oauth/oauth1.rb +25 -0
  13. data/lib/sorcery/controller/submodules/oauth/oauth2.rb +23 -0
  14. data/lib/sorcery/controller/submodules/oauth/providers/facebook.rb +64 -0
  15. data/lib/sorcery/controller/submodules/oauth/providers/twitter.rb +61 -0
  16. data/lib/sorcery/controller/submodules/remember_me.rb +14 -5
  17. data/lib/sorcery/controller/submodules/session_timeout.rb +6 -1
  18. data/lib/sorcery/engine.rb +9 -2
  19. data/lib/sorcery/model.rb +10 -3
  20. data/lib/sorcery/model/submodules/activity_logging.rb +12 -7
  21. data/lib/sorcery/model/submodules/brute_force_protection.rb +11 -4
  22. data/lib/sorcery/model/submodules/oauth.rb +53 -0
  23. data/lib/sorcery/model/submodules/remember_me.rb +5 -3
  24. data/lib/sorcery/model/submodules/reset_password.rb +16 -13
  25. data/lib/sorcery/model/submodules/user_activation.rb +38 -19
  26. data/lib/sorcery/model/temporary_token.rb +22 -0
  27. data/lib/sorcery/test_helpers.rb +84 -0
  28. data/sorcery.gemspec +69 -40
  29. data/spec/Gemfile +3 -2
  30. data/spec/Gemfile.lock +15 -2
  31. data/spec/rails3/app_root/.rspec +1 -0
  32. data/spec/rails3/{Gemfile → app_root/Gemfile} +5 -3
  33. data/spec/rails3/{Gemfile.lock → app_root/Gemfile.lock} +25 -2
  34. data/spec/rails3/{Rakefile → app_root/Rakefile} +0 -0
  35. data/spec/rails3/app_root/app/controllers/application_controller.rb +42 -1
  36. data/spec/rails3/app_root/app/models/authentication.rb +3 -0
  37. data/spec/rails3/app_root/app/models/user.rb +4 -1
  38. data/spec/rails3/app_root/config/application.rb +1 -3
  39. data/spec/rails3/app_root/config/routes.rb +1 -10
  40. data/spec/rails3/app_root/db/migrate/activation/20101224223622_add_activation_to_users.rb +6 -4
  41. data/spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb +4 -4
  42. data/spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb +14 -0
  43. data/spec/rails3/{controller_activity_logging_spec.rb → app_root/spec/controller_activity_logging_spec.rb} +13 -13
  44. data/spec/rails3/{controller_brute_force_protection_spec.rb → app_root/spec/controller_brute_force_protection_spec.rb} +16 -6
  45. data/spec/rails3/{controller_http_basic_auth_spec.rb → app_root/spec/controller_http_basic_auth_spec.rb} +3 -3
  46. data/spec/rails3/app_root/spec/controller_oauth2_spec.rb +117 -0
  47. data/spec/rails3/app_root/spec/controller_oauth_spec.rb +117 -0
  48. data/spec/rails3/{controller_remember_me_spec.rb → app_root/spec/controller_remember_me_spec.rb} +4 -4
  49. data/spec/rails3/{controller_session_timeout_spec.rb → app_root/spec/controller_session_timeout_spec.rb} +4 -4
  50. data/spec/rails3/{controller_spec.rb → app_root/spec/controller_spec.rb} +20 -13
  51. data/spec/rails3/app_root/spec/spec_helper.orig.rb +27 -0
  52. data/spec/rails3/app_root/spec/spec_helper.rb +61 -0
  53. data/spec/rails3/{user_activation_spec.rb → app_root/spec/user_activation_spec.rb} +60 -20
  54. data/spec/rails3/{user_activity_logging_spec.rb → app_root/spec/user_activity_logging_spec.rb} +4 -4
  55. data/spec/rails3/{user_brute_force_protection_spec.rb → app_root/spec/user_brute_force_protection_spec.rb} +7 -7
  56. data/spec/rails3/app_root/spec/user_oauth_spec.rb +39 -0
  57. data/spec/rails3/{user_remember_me_spec.rb → app_root/spec/user_remember_me_spec.rb} +4 -4
  58. data/spec/rails3/{user_reset_password_spec.rb → app_root/spec/user_reset_password_spec.rb} +21 -41
  59. data/spec/rails3/{user_spec.rb → app_root/spec/user_spec.rb} +68 -38
  60. metadata +127 -58
  61. data/spec/rails3/app_root/test/fixtures/users.yml +0 -9
  62. data/spec/rails3/app_root/test/performance/browsing_test.rb +0 -9
  63. data/spec/rails3/app_root/test/test_helper.rb +0 -13
  64. data/spec/rails3/app_root/test/unit/user_test.rb +0 -8
  65. data/spec/rails3/spec_helper.rb +0 -135
@@ -6,7 +6,7 @@ describe ApplicationController do
6
6
  describe ApplicationController, "with remember me features" do
7
7
  before(:all) do
8
8
  ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/remember_me")
9
- plugin_model_configure([:remember_me])
9
+ sorcery_reload!([:remember_me])
10
10
  end
11
11
 
12
12
  before(:each) do
@@ -25,7 +25,7 @@ describe ApplicationController do
25
25
 
26
26
  it "should set cookie on remember_me!" do
27
27
  post :test_login_with_remember, :username => 'gizmo', :password => 'secret'
28
- cookies["remember_me_token"].should == assigns[:logged_in_user].remember_me_token
28
+ cookies["remember_me_token"].should == assigns[:current_user].remember_me_token
29
29
  end
30
30
 
31
31
  it "should clear cookie on forget_me!" do
@@ -50,11 +50,11 @@ describe ApplicationController do
50
50
  session[:user_id] = @user.id
51
51
  subject.remember_me!
52
52
  subject.instance_eval do
53
- @logged_in_user = nil
53
+ @current_user = nil
54
54
  end
55
55
  session[:user_id] = nil
56
56
  get :test_login_from_cookie
57
- assigns[:logged_in_user].should == @user
57
+ assigns[:current_user].should == @user
58
58
  end
59
59
 
60
60
  it "should not remember_me! when not asked to" do
@@ -5,8 +5,8 @@ describe ApplicationController do
5
5
  # ----------------- SESSION TIMEOUT -----------------------
6
6
  describe ApplicationController, "with session timeout features" do
7
7
  before(:all) do
8
- plugin_model_configure([:session_timeout])
9
- plugin_set_controller_config_property(:session_timeout,0.5)
8
+ sorcery_reload!([:session_timeout])
9
+ sorcery_controller_property_set(:session_timeout,0.5)
10
10
  create_new_user
11
11
  end
12
12
 
@@ -26,7 +26,7 @@ describe ApplicationController do
26
26
  end
27
27
 
28
28
  it "with 'session_timeout_from_last_action' should not logout if there was activity" do
29
- plugin_set_controller_config_property(:session_timeout_from_last_action, true)
29
+ sorcery_controller_property_set(:session_timeout_from_last_action, true)
30
30
  login_user
31
31
  sleep 0.3
32
32
  get :test_should_be_logged_in
@@ -38,7 +38,7 @@ describe ApplicationController do
38
38
  end
39
39
 
40
40
  it "with 'session_timeout_from_last_action' should logout if there was no activity" do
41
- plugin_set_controller_config_property(:session_timeout_from_last_action, true)
41
+ sorcery_controller_property_set(:session_timeout_from_last_action, true)
42
42
  login_user
43
43
  sleep 0.6
44
44
  get :test_should_be_logged_in
@@ -5,21 +5,21 @@ describe ApplicationController do
5
5
  # ----------------- PLUGIN CONFIGURATION -----------------------
6
6
  describe ApplicationController, "plugin configuration" do
7
7
  before(:all) do
8
- plugin_model_configure
8
+ sorcery_reload!
9
9
  end
10
10
 
11
11
  after(:each) do
12
12
  Sorcery::Controller::Config.reset!
13
- plugin_model_configure
13
+ sorcery_reload!
14
14
  end
15
15
 
16
16
  it "should enable configuration option 'user_class'" do
17
- plugin_set_controller_config_property(:user_class, TestUser)
17
+ sorcery_controller_property_set(:user_class, TestUser)
18
18
  Sorcery::Controller::Config.user_class.should equal(TestUser)
19
19
  end
20
20
 
21
21
  it "should enable configuration option 'not_authenticated_action'" do
22
- plugin_set_controller_config_property(:not_authenticated_action, :my_action)
22
+ sorcery_controller_property_set(:not_authenticated_action, :my_action)
23
23
  Sorcery::Controller::Config.not_authenticated_action.should equal(:my_action)
24
24
  end
25
25
 
@@ -34,7 +34,7 @@ describe ApplicationController do
34
34
 
35
35
  after(:each) do
36
36
  Sorcery::Controller::Config.reset!
37
- plugin_set_controller_config_property(:user_class, User)
37
+ sorcery_controller_property_set(:user_class, User)
38
38
  end
39
39
 
40
40
  it "should respond to the instance method login" do
@@ -49,8 +49,8 @@ describe ApplicationController do
49
49
  should respond_to(:logged_in?)
50
50
  end
51
51
 
52
- it "should respond to the instance method logged_in_user" do
53
- should respond_to(:logged_in_user)
52
+ it "should respond to the instance method current_user" do
53
+ should respond_to(:current_user)
54
54
  end
55
55
 
56
56
  it "login(username,password) should return the user when success and set the session with user.id" do
@@ -82,15 +82,15 @@ describe ApplicationController do
82
82
  subject.logged_in?.should be_false
83
83
  end
84
84
 
85
- it "logged_in_user should return the user instance if logged in" do
85
+ it "current_user should return the user instance if logged in" do
86
86
  create_new_user
87
87
  session[:user_id] = @user.id
88
- subject.logged_in_user.should == @user
88
+ subject.current_user.should == @user
89
89
  end
90
90
 
91
- it "logged_in_user should return false if not logged in" do
91
+ it "current_user should return false if not logged in" do
92
92
  session[:user_id] = nil
93
- subject.logged_in_user.should == false
93
+ subject.current_user.should == false
94
94
  end
95
95
 
96
96
  it "should respond to 'require_login'" do
@@ -99,17 +99,24 @@ describe ApplicationController do
99
99
 
100
100
  it "should call the configured 'not_authenticated_action' when authenticate before_filter fails" do
101
101
  session[:user_id] = nil
102
- plugin_set_controller_config_property(:not_authenticated_action, :test_not_authenticated_action)
102
+ sorcery_controller_property_set(:not_authenticated_action, :test_not_authenticated_action)
103
103
  get :test_logout
104
104
  response.body.should == "test_not_authenticated_action"
105
105
  end
106
106
 
107
107
  it "require_login before_filter should save the url that the user originally wanted" do
108
108
  get :some_action
109
- session[:user_wanted_url].should == "http://test.host/some_action"
109
+ session[:return_to_url].should == "http://test.host/application/some_action"
110
110
  response.should redirect_to("http://test.host/")
111
111
  end
112
112
 
113
+ it "on successful login the user should be redirected to the url he originally wanted" do
114
+ session[:return_to_url] = "http://test.host/some_action"
115
+ post :test_return_to, :username => 'gizmo', :password => 'secret'
116
+ response.should redirect_to("http://test.host/some_action")
117
+ flash[:notice].should == "haha!"
118
+ end
119
+
113
120
  end
114
121
 
115
122
  end
@@ -0,0 +1,27 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+
6
+ # Requires supporting ruby files with custom matchers and macros, etc,
7
+ # in spec/support/ and its subdirectories.
8
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ # == Mock Framework
12
+ #
13
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14
+ #
15
+ # config.mock_with :mocha
16
+ # config.mock_with :flexmock
17
+ # config.mock_with :rr
18
+ config.mock_with :rspec
19
+
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+
23
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
+ # examples within a transaction, remove the following line or assign false
25
+ # instead of true.
26
+ config.use_transactional_fixtures = true
27
+ end
@@ -0,0 +1,61 @@
1
+ $: << File.join(File.dirname(__FILE__), '..', '..', 'lib' )
2
+
3
+ require 'simplecov'
4
+ SimpleCov.root File.join(File.dirname(__FILE__), "..", "..", "app_root" )
5
+ SimpleCov.start do
6
+ add_filter "/config/"
7
+
8
+ add_group 'Controllers', 'app/controllers'
9
+ add_group 'Models', 'app/models'
10
+ add_group 'Helpers', 'app/helpers'
11
+ add_group 'Libraries', 'lib'
12
+ add_group 'Plugins', 'vendor/plugins'
13
+ add_group 'Migrations', 'db/migrate'
14
+ end
15
+
16
+ require 'spork'
17
+
18
+ Spork.prefork do
19
+ # Set the default environment to sqlite3's in_memory database
20
+ ENV['RAILS_ENV'] ||= 'in_memory'
21
+ ENV['RAILS_ROOT'] = 'app_root'
22
+
23
+ # Load the Rails environment and testing framework
24
+ require "#{File.dirname(__FILE__)}/../config/environment"
25
+ #require "#{File.dirname(__FILE__)}/../../init" # for plugins
26
+ require 'rspec/rails'
27
+
28
+ RSpec.configure do |config|
29
+ config.use_transactional_fixtures = true
30
+ config.use_instantiated_fixtures = false
31
+ config.include RSpec::Rails::ControllerExampleGroup, :example_group => { :file_path => /controller(.)*_spec.rb$/ }
32
+
33
+ config.before(:suite) do
34
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/core")
35
+ end
36
+
37
+ config.after(:suite) do
38
+ ActiveRecord::Migrator.rollback("#{Rails.root}/db/migrate/core")
39
+ end
40
+ end
41
+
42
+ #----------------------------------------------------------------
43
+ # needed when running individual specs
44
+ require File.join(File.dirname(__FILE__), '..','app','models','user')
45
+ require File.join(File.dirname(__FILE__), '..','app','models','authentication')
46
+
47
+ class TestUser < ActiveRecord::Base
48
+ activate_sorcery!
49
+ end
50
+
51
+ class TestMailer < ActionMailer::Base
52
+
53
+ end
54
+
55
+ include ::Sorcery::TestHelpers
56
+
57
+ end
58
+
59
+ Spork.each_run do
60
+ # This code will be run each time you run your specs.
61
+ end
@@ -1,5 +1,5 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
- require File.expand_path(File.dirname(__FILE__) + '/app_root/app/mailers/sorcery_mailer')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../app/mailers/sorcery_mailer')
3
3
 
4
4
  describe "User with activation submodule" do
5
5
  before(:all) do
@@ -13,53 +13,53 @@ describe "User with activation submodule" do
13
13
  # ----------------- PLUGIN CONFIGURATION -----------------------
14
14
  describe User, "loaded plugin configuration" do
15
15
  before(:all) do
16
- plugin_model_configure([:user_activation], :user_activation_mailer => ::SorceryMailer)
16
+ sorcery_reload!([:user_activation], :user_activation_mailer => ::SorceryMailer)
17
17
  end
18
18
 
19
19
  after(:each) do
20
20
  User.sorcery_config.reset!
21
- plugin_model_configure([:user_activation], :user_activation_mailer => ::SorceryMailer)
21
+ sorcery_reload!([:user_activation], :user_activation_mailer => ::SorceryMailer)
22
22
  end
23
23
 
24
24
  it "should enable configuration option 'activation_state_attribute_name'" do
25
- plugin_set_model_config_property(:activation_state_attribute_name, :status)
25
+ sorcery_model_property_set(:activation_state_attribute_name, :status)
26
26
  User.sorcery_config.activation_state_attribute_name.should equal(:status)
27
27
  end
28
28
 
29
- it "should enable configuration option 'activation_code_attribute_name'" do
30
- plugin_set_model_config_property(:activation_code_attribute_name, :code)
31
- User.sorcery_config.activation_code_attribute_name.should equal(:code)
29
+ it "should enable configuration option 'activation_token_attribute_name'" do
30
+ sorcery_model_property_set(:activation_token_attribute_name, :code)
31
+ User.sorcery_config.activation_token_attribute_name.should equal(:code)
32
32
  end
33
33
 
34
34
  it "should enable configuration option 'user_activation_mailer'" do
35
- plugin_set_model_config_property(:user_activation_mailer, TestMailer)
35
+ sorcery_model_property_set(:user_activation_mailer, TestMailer)
36
36
  User.sorcery_config.user_activation_mailer.should equal(TestMailer)
37
37
  end
38
38
 
39
39
  it "should enable configuration option 'activation_needed_email_method_name'" do
40
- plugin_set_model_config_property(:activation_needed_email_method_name, :my_activation_email)
40
+ sorcery_model_property_set(:activation_needed_email_method_name, :my_activation_email)
41
41
  User.sorcery_config.activation_needed_email_method_name.should equal(:my_activation_email)
42
42
  end
43
43
 
44
44
  it "should enable configuration option 'activation_success_email_method_name'" do
45
- plugin_set_model_config_property(:activation_success_email_method_name, :my_activation_email)
45
+ sorcery_model_property_set(:activation_success_email_method_name, :my_activation_email)
46
46
  User.sorcery_config.activation_success_email_method_name.should equal(:my_activation_email)
47
47
  end
48
48
 
49
49
  it "if mailer is nil on activation, throw exception!" do
50
- expect{plugin_model_configure([:user_activation])}.to raise_error(ArgumentError)
50
+ expect{sorcery_reload!([:user_activation])}.to raise_error(ArgumentError)
51
51
  end
52
52
  end
53
53
 
54
54
  # ----------------- ACTIVATION PROCESS -----------------------
55
55
  describe User, "activation process" do
56
56
  before(:all) do
57
- plugin_model_configure([:user_activation], :user_activation_mailer => ::SorceryMailer)
57
+ sorcery_reload!([:user_activation], :user_activation_mailer => ::SorceryMailer)
58
58
  end
59
59
 
60
60
  it "should generate an activation code on registration" do
61
61
  create_new_user
62
- @user.activation_code.should_not be_nil
62
+ @user.activation_token.should_not be_nil
63
63
  end
64
64
 
65
65
  it "should initialize user state to 'pending'" do
@@ -74,12 +74,12 @@ describe "User with activation submodule" do
74
74
 
75
75
  it "should clear activation code and change state to 'active' on activation" do
76
76
  create_new_user
77
- activation_code = @user.activation_code
77
+ activation_token = @user.activation_token
78
78
  @user.activate!
79
79
  @user2 = User.find(@user.id) # go to db to make sure it was saved and not just in memory
80
- @user2.activation_code.should be_nil
80
+ @user2.activation_token.should be_nil
81
81
  @user2.activation_state.should == "active"
82
- User.find_by_activation_code(activation_code).should be_nil
82
+ User.find_by_activation_token(activation_token).should be_nil
83
83
  end
84
84
 
85
85
  it "should send the user an activation email" do
@@ -113,14 +113,14 @@ describe "User with activation submodule" do
113
113
  end
114
114
 
115
115
  it "activation needed email is optional" do
116
- plugin_set_model_config_property(:activation_needed_email_method_name, nil)
116
+ sorcery_model_property_set(:activation_needed_email_method_name, nil)
117
117
  old_size = ActionMailer::Base.deliveries.size
118
118
  create_new_user
119
119
  ActionMailer::Base.deliveries.size.should == old_size
120
120
  end
121
121
 
122
122
  it "activation success email is optional" do
123
- plugin_set_model_config_property(:activation_success_email_method_name, nil)
123
+ sorcery_model_property_set(:activation_success_email_method_name, nil)
124
124
  create_new_user
125
125
  old_size = ActionMailer::Base.deliveries.size
126
126
  @user.activate!
@@ -130,7 +130,7 @@ describe "User with activation submodule" do
130
130
 
131
131
  describe User, "prevent non-active login feature" do
132
132
  before(:all) do
133
- plugin_model_configure([:user_activation], :user_activation_mailer => ::SorceryMailer)
133
+ sorcery_reload!([:user_activation], :user_activation_mailer => ::SorceryMailer)
134
134
  end
135
135
 
136
136
  it "should not allow a non-active user to authenticate" do
@@ -140,9 +140,49 @@ describe "User with activation submodule" do
140
140
 
141
141
  it "should allow a non-active user to authenticate if configured so" do
142
142
  create_new_user
143
- plugin_set_model_config_property(:prevent_non_active_users_to_login, false)
143
+ sorcery_model_property_set(:prevent_non_active_users_to_login, false)
144
144
  User.authenticate(@user.username,'secret').should be_true
145
145
  end
146
146
  end
147
147
 
148
+ describe User, "load_from_activation_token" do
149
+ before(:all) do
150
+ sorcery_reload!([:user_activation], :user_activation_mailer => ::SorceryMailer)
151
+ end
152
+
153
+ it "load_from_activation_token should return user when token is found" do
154
+ create_new_user
155
+ User.load_from_activation_token(@user.activation_token).should == @user
156
+ end
157
+
158
+ it "load_from_activation_token should NOT return user when token is NOT found" do
159
+ create_new_user
160
+ User.load_from_activation_token("a").should == nil
161
+ end
162
+
163
+ it "load_from_activation_token should return user when token is found and not expired" do
164
+ sorcery_model_property_set(:activation_token_expiration_period, 500)
165
+ create_new_user
166
+ User.load_from_activation_token(@user.activation_token).should == @user
167
+ end
168
+
169
+ it "load_from_activation_token should NOT return user when token is found and expired" do
170
+ sorcery_model_property_set(:activation_token_expiration_period, 0.1)
171
+ create_new_user
172
+ sleep 0.5
173
+ User.load_from_activation_token(@user.activation_token).should == nil
174
+ end
175
+
176
+ it "load_from_activation_token should return nil if token is blank" do
177
+ User.load_from_activation_token(nil).should == nil
178
+ User.load_from_activation_token("").should == nil
179
+ end
180
+
181
+ it "load_from_activation_token should always be valid if expiration period is nil" do
182
+ sorcery_model_property_set(:activation_token_expiration_period, nil)
183
+ create_new_user
184
+ User.load_from_activation_token(@user.activation_token).should == @user
185
+ end
186
+ end
187
+
148
188
  end
@@ -10,7 +10,7 @@ describe "User with activity logging submodule" do
10
10
  # ----------------- PLUGIN CONFIGURATION -----------------------
11
11
  describe User, "loaded plugin configuration" do
12
12
  before(:all) do
13
- plugin_model_configure([:activity_logging])
13
+ sorcery_reload!([:activity_logging])
14
14
  end
15
15
 
16
16
  after(:each) do
@@ -18,17 +18,17 @@ describe "User with activity logging submodule" do
18
18
  end
19
19
 
20
20
  it "should allow configuration option 'last_login_at_attribute_name'" do
21
- plugin_set_model_config_property(:last_login_at_attribute_name, :login_time)
21
+ sorcery_model_property_set(:last_login_at_attribute_name, :login_time)
22
22
  User.sorcery_config.last_login_at_attribute_name.should equal(:login_time)
23
23
  end
24
24
 
25
25
  it "should allow configuration option 'last_logout_at_attribute_name'" do
26
- plugin_set_model_config_property(:last_logout_at_attribute_name, :logout_time)
26
+ sorcery_model_property_set(:last_logout_at_attribute_name, :logout_time)
27
27
  User.sorcery_config.last_logout_at_attribute_name.should equal(:logout_time)
28
28
  end
29
29
 
30
30
  it "should allow configuration option 'last_activity_at_attribute_name'" do
31
- plugin_set_model_config_property(:last_activity_at_attribute_name, :activity_time)
31
+ sorcery_model_property_set(:last_activity_at_attribute_name, :activity_time)
32
32
  User.sorcery_config.last_activity_at_attribute_name.should equal(:activity_time)
33
33
  end
34
34
  end
@@ -13,7 +13,7 @@ describe "User with brute_force_protection submodule" do
13
13
  describe User, "loaded plugin configuration" do
14
14
 
15
15
  before(:all) do
16
- plugin_model_configure([:brute_force_protection])
16
+ sorcery_reload!([:brute_force_protection])
17
17
  create_new_user
18
18
  end
19
19
 
@@ -30,22 +30,22 @@ describe "User with brute_force_protection submodule" do
30
30
  end
31
31
 
32
32
  it "should enable configuration option 'failed_logins_count_attribute_name'" do
33
- plugin_set_model_config_property(:failed_logins_count_attribute_name, :my_count)
33
+ sorcery_model_property_set(:failed_logins_count_attribute_name, :my_count)
34
34
  User.sorcery_config.failed_logins_count_attribute_name.should equal(:my_count)
35
35
  end
36
36
 
37
37
  it "should enable configuration option 'lock_expires_at_attribute_name'" do
38
- plugin_set_model_config_property(:lock_expires_at_attribute_name, :expires)
38
+ sorcery_model_property_set(:lock_expires_at_attribute_name, :expires)
39
39
  User.sorcery_config.lock_expires_at_attribute_name.should equal(:expires)
40
40
  end
41
41
 
42
42
  it "should enable configuration option 'consecutive_login_retries_amount_allowed'" do
43
- plugin_set_model_config_property(:consecutive_login_retries_amount_allowed, 34)
44
- User.sorcery_config.consecutive_login_retries_amount_allowed.should equal(34)
43
+ sorcery_model_property_set(:consecutive_login_retries_amount_limit, 34)
44
+ User.sorcery_config.consecutive_login_retries_amount_limit.should equal(34)
45
45
  end
46
46
 
47
47
  it "should enable configuration option 'login_lock_time_period'" do
48
- plugin_set_model_config_property(:login_lock_time_period, 2.hours)
48
+ sorcery_model_property_set(:login_lock_time_period, 2.hours)
49
49
  User.sorcery_config.login_lock_time_period.should == 2.hours
50
50
  end
51
51
  end
@@ -54,7 +54,7 @@ describe "User with brute_force_protection submodule" do
54
54
  describe User, "when activated with sorcery" do
55
55
 
56
56
  before(:all) do
57
- plugin_model_configure([:brute_force_protection])
57
+ sorcery_reload!([:brute_force_protection])
58
58
  end
59
59
 
60
60
  before(:each) do