Skip to content

Commit

Permalink
Changed named_scope to scope
Browse files Browse the repository at this point in the history
  • Loading branch information
fedesoria committed Jan 4, 2011
1 parent 66ed795 commit 6bcac31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/authlogic/acts_as_authentic/logged_in_status.rb
Expand Up @@ -32,8 +32,8 @@ def self.included(klass)
klass.class_eval do
include InstanceMethods

named_scope :logged_in, lambda { {:conditions => ["last_request_at > ?", logged_in_timeout.seconds.ago]} }
named_scope :logged_out, lambda { {:conditions => ["last_request_at is NULL or last_request_at <= ?", logged_in_timeout.seconds.ago]} }
scope :logged_in, lambda { {:conditions => ["last_request_at > ?", logged_in_timeout.seconds.ago]} }
scope :logged_out, lambda { {:conditions => ["last_request_at is NULL or last_request_at <= ?", logged_in_timeout.seconds.ago]} }
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/acts_as_authentic_test/logged_in_status_test.rb
Expand Up @@ -12,13 +12,13 @@ def test_logged_in_timeout_config
assert_equal 10.minutes.to_i, User.logged_in_timeout
end

def test_named_scope_logged_in
def test_scope_logged_in
assert_equal 0, User.logged_in.count
User.first.update_attribute(:last_request_at, Time.now)
assert_equal 1, User.logged_in.count
end

def test_named_scope_logged_out
def test_scope_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
Expand Down

0 comments on commit 6bcac31

Please sign in to comment.