Skip to content
Browse files

remove the simple / pointless generator

  • Loading branch information...
1 parent 7aed570 commit c2ef11b311609ec46335085ffa67c15925f8330a @binarylogic committed
View
2 Gemfile
@@ -1,2 +1,2 @@
source :rubygems
-gemspec
+gemspec
View
22 Gemfile.lock
@@ -8,25 +8,25 @@ PATH
GEM
remote: http://rubygems.org/
specs:
- activemodel (3.2.6)
- activesupport (= 3.2.6)
+ activemodel (3.2.9)
+ activesupport (= 3.2.9)
builder (~> 3.0.0)
- activerecord (3.2.6)
- activemodel (= 3.2.6)
- activesupport (= 3.2.6)
+ activerecord (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activesupport (3.2.6)
+ activesupport (3.2.9)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
- builder (3.0.0)
- i18n (0.6.0)
- multi_json (1.3.6)
- rake (0.9.2.2)
+ builder (3.0.4)
+ i18n (0.6.1)
+ multi_json (1.4.0)
+ rake (10.0.2)
sqlite3 (1.3.6)
- tzinfo (0.3.33)
+ tzinfo (0.3.35)
PLATFORMS
ruby
View
2 Rakefile
@@ -1,5 +1,5 @@
require 'rubygems'
-require 'rake'
+require 'bundler'
Bundler.setup
View
2 lib/authlogic/acts_as_authentic/logged_in_status.rb
@@ -31,7 +31,7 @@ def self.included(klass)
klass.class_eval do
include InstanceMethods
- scope :logged_in, lambda{ where("last_request_at > ? and last_login_at IS NOT NULL", logged_in_timeout.seconds.ago) }
+ scope :logged_in, lambda{ where("last_request_at > ? and current_login_at IS NOT NULL", logged_in_timeout.seconds.ago) }
scope :logged_out, lambda{ where("last_request_at is NULL or last_request_at <= ?", logged_in_timeout.seconds.ago) }
end
end
View
8 lib/generators/authlogic/USAGE
@@ -1,8 +0,0 @@
-Description:
- Create session model that represents the user’s current session.
-
-Example:
- rails generate authlogic:session UserSession
-
- This will create:
- Model UserSession in app/models directory
View
14 lib/generators/authlogic/session_generator.rb
@@ -1,14 +0,0 @@
-module Authlogic
- class SessionGenerator < Rails::Generators::Base
- source_root File.expand_path('../templates', __FILE__)
- argument :session_class_name, :type => :string, :default => "Session"
-
- def self.banner
- "rails generate authlogic:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
- end
-
- def generate_session
- template "session.rb", "app/models/#{session_class_name.underscore}.rb"
- end
- end
-end
View
2 lib/generators/authlogic/templates/session.rb
@@ -1,2 +0,0 @@
-class <%= session_class_name %> < Authlogic::Session::Base
-end
View
27 test/acts_as_authentic_test/logged_in_status_test.rb
@@ -3,41 +3,44 @@
module ActsAsAuthenticTest
class LoggedInStatusTest < ActiveSupport::TestCase
ERROR_MSG = 'Multiple calls to %s should result in different relations'
-
+
def test_logged_in_timeout_config
assert_equal 10.minutes.to_i, User.logged_in_timeout
assert_equal 10.minutes.to_i, Employee.logged_in_timeout
-
+
User.logged_in_timeout = 1.hour
assert_equal 1.hour.to_i, User.logged_in_timeout
User.logged_in_timeout 10.minutes
assert_equal 10.minutes.to_i, User.logged_in_timeout
end
-
+
def test_named_scope_logged_in
- # Testing that the scope returned differs, because the time it was called should be
- # slightly different. This is an attempt to make sure the scope is lambda wrapped
+ # Testing that the scope returned differs, because the time it was called should be
+ # slightly different. This is an attempt to make sure the scope is lambda wrapped
# so that it is re-evaluated every time its called. My biggest concern is that the
# test happens so fast that the test fails... I just don't know a better way to test it!
assert User.logged_in.where_values != User.logged_in.where_values, ERROR_MSG % '#logged_in'
-
+
assert_equal 0, User.logged_in.count
- User.first.update_attribute(:last_request_at, Time.now)
+ user = User.first
+ user.last_request_at = Time.now
+ user.current_login_at = Time.now
+ user.save!
assert_equal 1, User.logged_in.count
end
-
+
def test_named_scope_logged_out
- # Testing that the scope returned differs, because the time it was called should be
- # slightly different. This is an attempt to make sure the scope is lambda wrapped
+ # Testing that the scope returned differs, because the time it was called should be
+ # slightly different. This is an attempt to make sure the scope is lambda wrapped
# so that it is re-evaluated every time its called. My biggest concern is that the
# test happens so fast that the test fails... I just don't know a better way to test it!
assert User.logged_in.where_values != User.logged_out.where_values, ERROR_MSG % '#logged_out'
-
+
assert_equal 2, User.logged_out.count
User.first.update_attribute(:last_request_at, Time.now)
assert_equal 1, User.logged_out.count
end
-
+
def test_logged_in_logged_out
u = User.first
assert !u.logged_in?

0 comments on commit c2ef11b

Please sign in to comment.
Something went wrong with that request. Please try again.