-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add admin autolock feature * use devise-security-extension gem to support rails v3 * override devise security update_last_activity method to support mongoid * fix rspecs * fix another spec failure
- Loading branch information
1 parent
768bcbd
commit afbb56b
Showing
6 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
DEVISE_ORM = :mongoid | ||
require File.expand_path('../boot', __FILE__) | ||
|
||
# Pick the frameworks you want: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'rails_helper' | ||
|
||
describe UsersController, :dbclean => :after_each do | ||
|
||
describe 'GET index' do | ||
context "attempting to log in an expired user" do | ||
let(:user) do | ||
user_record = FactoryGirl.create(:user, :admin) | ||
user_record.last_activity_at = Time.now - 180.days | ||
user_record.save! | ||
user_record | ||
end | ||
|
||
it "can't access the endpoint" do | ||
sign_in user | ||
get :index | ||
expect(response).to redirect_to("http://test.host/accounts/sign_in") | ||
end | ||
end | ||
|
||
context "attempting to log in an valid user" do | ||
let(:user) do | ||
user_record = FactoryGirl.create(:user, :admin) | ||
user_record.save! | ||
user_record | ||
end | ||
|
||
it "can't access the endpoint" do | ||
sign_in user | ||
get :index | ||
expect(response).to render_template :index | ||
end | ||
end | ||
end | ||
end |