Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
130 additions
and
11 deletions.
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
98 changes: 98 additions & 0 deletions
98
spec/rails3_mongoid/spec/controller_activity_logging_spec.rb
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,98 @@ | ||
# require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
# | ||
# describe ApplicationController do | ||
# | ||
# # ----------------- ACTIVITY LOGGING ----------------------- | ||
# describe ApplicationController, "with activity logging features" do | ||
# before(:all) do | ||
# sorcery_reload!([:activity_logging]) | ||
# end | ||
# | ||
# before(:each) do | ||
# create_new_user | ||
# end | ||
# | ||
# after(:each) do | ||
# User.delete_all | ||
# end | ||
# | ||
# specify { subject.should respond_to(:current_users) } | ||
# | ||
# it "'current_users' should be empty when no users are logged in" do | ||
# subject.current_users.size.should == 0 | ||
# end | ||
# | ||
# it "should log login time on login" do | ||
# now = Time.now.utc | ||
# login_user | ||
# @user.last_login_at.should_not be_nil | ||
# @user.last_login_at.to_s(:db).should >= now.to_s(:db) | ||
# @user.last_login_at.to_s(:db).should <= (now+2).to_s(:db) | ||
# end | ||
# | ||
# it "should log logout time on logout" do | ||
# login_user | ||
# now = Time.now.utc | ||
# logout_user | ||
# User.first.last_logout_at.should_not be_nil | ||
# User.first.last_logout_at.to_s(:db).should >= now.to_s(:db) | ||
# User.first.last_logout_at.to_s(:db).should <= (now+2).to_s(:db) | ||
# end | ||
# | ||
# it "should log last activity time when logged in" do | ||
# login_user | ||
# now = Time.now.utc | ||
# get :some_action | ||
# User.first.last_activity_at.to_s(:db).should >= now.to_s(:db) | ||
# User.first.last_activity_at.to_s(:db).should <= (now+2).to_s(:db) | ||
# end | ||
# | ||
# it "'current_users' should hold the user object when 1 user is logged in" do | ||
# login_user | ||
# get :some_action | ||
# subject.current_users.size.should == 1 | ||
# subject.current_users[0].should == @user | ||
# end | ||
# | ||
# it "'current_users' should show all current_users, whether they have logged out before or not." do | ||
# user1 = create_new_user({:username => 'gizmo1', :email => "bla1@bla.com", :password => 'secret1'}) | ||
# login_user(user1) | ||
# get :some_action | ||
# clear_user_without_logout | ||
# user2 = create_new_user({:username => 'gizmo2', :email => "bla2@bla.com", :password => 'secret2'}) | ||
# login_user(user2) | ||
# get :some_action | ||
# clear_user_without_logout | ||
# user3 = create_new_user({:username => 'gizmo3', :email => "bla3@bla.com", :password => 'secret3'}) | ||
# login_user(user3) | ||
# get :some_action | ||
# subject.current_users.size.should == 3 | ||
# subject.current_users[0].should == user1 | ||
# subject.current_users[1].should == user2 | ||
# subject.current_users[2].should == user3 | ||
# end | ||
# | ||
# it "should not register login time if configured so" do | ||
# sorcery_controller_property_set(:register_login_time, false) | ||
# now = Time.now.utc | ||
# login_user | ||
# @user.last_login_at.should be_nil | ||
# end | ||
# | ||
# it "should not register logout time if configured so" do | ||
# sorcery_controller_property_set(:register_logout_time, false) | ||
# now = Time.now.utc | ||
# login_user | ||
# logout_user | ||
# @user.last_logout_at.should be_nil | ||
# end | ||
# | ||
# it "should not register last activity time if configured so" do | ||
# sorcery_controller_property_set(:register_last_activity_time, false) | ||
# now = Time.now.utc | ||
# login_user | ||
# get :some_action | ||
# @user.last_activity_at.should be_nil | ||
# end | ||
# end | ||
# end |
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