sixarm_ruby_current_user_id 1.2.6 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.txt ADDED
@@ -0,0 +1,4 @@
1
+ CHANGELOG
2
+
3
+ 2011-04-19 1.3.2 Bump to match sixarm_ruby_current_user gem
4
+ 2011-04-18 1.3.0 Public release of version for Ruby 1.9.2 and Rails 3.0.5
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = SixArm.com » Ruby » CurrentUserId module for Rails sessions
2
2
 
3
- Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
3
+ Author:: Joel Parker Henderson, joel@joelparkerhenderson.com
4
4
  Copyright:: Copyright (c) 2006-2011 Joel Parker Henderson
5
5
  License:: See LICENSE.txt file
6
6
 
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.3.4
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin rdoc
3
- Please see README.rdoc
3
+ Please see README.rdoc
4
4
  =end
5
5
 
6
6
  module CurrentUserId
@@ -14,11 +14,18 @@ module CurrentUserId
14
14
  end
15
15
 
16
16
 
17
+ # Is there a current user id in the Rails session array?
18
+
19
+ def current_user_id?
20
+ return session[:current_user_id] ? true : false
21
+ end
22
+
23
+
17
24
  # Set the current user id in the Rails session array.
18
25
  # Return the current user id, suitable for chaining.
19
26
 
20
27
  def current_user_id=(id)
21
- return session[:current_user_id]=id
28
+ session[:current_user_id]=id
22
29
  end
23
30
 
24
31
 
@@ -1,31 +1,36 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'test/unit'
2
3
  require 'sixarm_ruby_current_user_id'
3
- require 'simplecov'
4
- SimpleCov.start
4
+ #require 'simplecov'
5
+ #SimpleCov.start
5
6
 
6
7
  class Testing < Test::Unit::TestCase
7
8
 
8
- include CurrentUserId
9
-
9
+ # Mock session
10
10
  def session
11
- @session||=Hash.new
11
+ return @session||={}
12
12
  end
13
13
 
14
+ include CurrentUserId
15
+
14
16
  ID=1234
15
-
16
- def test_current_user_id_before_setting
17
- assert_nil(current_user_id, "current_user_id is not set, so should be nil")
18
- end
19
17
 
20
- def test_current_user_id_equals_return
21
- assert_equal(ID, current_user_id=ID, "current_user_id is set to #{ID}, so current_user_id should return #{ID}")
18
+ def test_current_user_id_default_is_nil
19
+ assert_nil(self.current_user_id, "current_user_id is not set, so current_user_id should be nil")
22
20
  end
23
-
21
+
24
22
  def test_current_user_id_round_trip
25
- current_user_id=ID
26
- expect=ID
27
- actual=current_user_id
28
- assert_equal(expect, actual, "current_user_id")
23
+ self.current_user_id=ID
24
+ assert_equal(ID, current_user_id, "current_user_id is set, so current_user_id should be an id")
25
+ end
26
+
27
+ def test_current_user_id_question_is_false
28
+ assert_equal(false, current_user_id?, "current_user_id is not set, so current_user_id? should be false")
29
+ end
30
+
31
+ def test_current_user_id_question_is_true
32
+ self.current_user_id=ID
33
+ assert_equal(true, current_user_id?, "current_user_id is set, so current_user_id? should be true")
29
34
  end
30
35
 
31
36
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sixarm_ruby_current_user_id
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.6
5
+ version: 1.3.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - SixArm
@@ -30,7 +30,7 @@ cert_chain:
30
30
  eabwpCbAopo=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2011-04-18 00:00:00 -07:00
33
+ date: 2011-04-22 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies: []
36
36
 
@@ -44,10 +44,12 @@ extra_rdoc_files: []
44
44
 
45
45
  files:
46
46
  - .gemtest
47
- - Rakefile
48
- - README.rdoc
47
+ - CHANGELOG.txt
49
48
  - INSTALL.txt
50
49
  - LICENSE.txt
50
+ - Rakefile
51
+ - README.rdoc
52
+ - VERSION
51
53
  - lib/sixarm_ruby_current_user_id.rb
52
54
  - test/sixarm_ruby_current_user_id_test.rb
53
55
  has_rdoc: true
metadata.gz.sig CHANGED
Binary file