currentuser-services 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae898926da5133f9853c0ebaa2175501e5811373
4
- data.tar.gz: 868f2530dd74510911dd066b2bdaf4c35714c4fb
3
+ metadata.gz: 4bed2624d3407bf18098ccda4f4091a6c1b16403
4
+ data.tar.gz: 43aaead3751bb9df1d2f6da1b76506eac57811d1
5
5
  SHA512:
6
- metadata.gz: ce33859a9a81ce55ad6f1d1a681bd90f6a23a259e16861cf946ed8e4cef485a817bf0453737e62b367b91fc03dea561eb3549afcca42425da09cd48a2694f1aa
7
- data.tar.gz: 3fb58eccbd97420401bd3130e16ffff5e3d574f0b39b3e831957f1e98176130e528c00029ad7269dd2756baf067dbf0d63d01c7b4e3a36bc5ccdc0e4a0632c41
6
+ metadata.gz: 76cd438c0731a783f151c4502b7cc979f806d9fe987c9521e2ce41f5a07ad3891176e6c2d23a99067c5d94b9c9fb8aaa6e76a79a1fb83c60840e63663ce61378
7
+ data.tar.gz: fb8b4e25f8e857a3aa7c2d2072e01a86ddc7c7eb1616c1f70cdc1d3f3d865c08032cbfd65780d75e3f5ea33461c911825d17ef5728041f040ed933d6b190047e
@@ -1,8 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3 ##
4
+
5
+ **Bugfix**
6
+
7
+ * Don't use symbol in session values, as they may be stringified with Rails 4.2.0
8
+
3
9
  ## 0.2.2 ##
4
10
 
5
- ** Bugfix**
11
+ **Bugfix**
6
12
 
7
13
  * Fix controller requirement for ruby 2.1+
8
14
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -5,10 +5,16 @@ module Currentuser
5
5
  def sign_in
6
6
  Services.check_authentication_params!(params)
7
7
 
8
+ # Note: in this method, we create an hash with string keys because, with Rails 4.2.0, keys are stringified
9
+ # between two requests if session is stored in a json cookie (which is the default behavior for Rails 4.2.0).
10
+ hash = {}
11
+
8
12
  # Log in
9
- session[:currentuser] = {id: params[:currentuser_id]}
13
+ hash['id'] = params[:currentuser_id]
10
14
  # Note that params[:sign_up] should equal 'true' (String) or should be absent.
11
- session[:currentuser][:sign_up] = true if params[:sign_up]
15
+ hash['sign_up'] = true if params[:sign_up]
16
+
17
+ session[:currentuser] = hash
12
18
 
13
19
  redirect_to '/'
14
20
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: currentuser-services 0.2.2 ruby lib
5
+ # stub: currentuser-services 0.2.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "currentuser-services"
9
- s.version = "0.2.2"
9
+ s.version = "0.2.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["eric-currentuser"]
14
- s.date = "2015-02-15"
14
+ s.date = "2015-03-04"
15
15
  s.description = "Offsite sign up and sign in forms for Currentuser.io"
16
16
  s.email = "TBD"
17
17
  s.extra_rdoc_files = [
@@ -11,7 +11,7 @@ module Currentuser
11
11
  end
12
12
 
13
13
  def currentuser_id
14
- return @currentuser_id ||= currentuser_session && currentuser_session[:id]
14
+ return @currentuser_id ||= currentuser_session && currentuser_session['id']
15
15
  end
16
16
 
17
17
  def currentuser_sign_in_url
@@ -30,7 +30,7 @@ module Currentuser
30
30
  # require_currentuser
31
31
 
32
32
  test 'execute action if currentuser_id is available' do
33
- session[:currentuser] = {id: 'user_id_1'}
33
+ session[:currentuser] = {'id' => 'user_id_1'}
34
34
 
35
35
  get_with_route :test_action_requiring_user
36
36
  assert_response :ok
@@ -47,15 +47,15 @@ module Currentuser
47
47
  # currentuser_session
48
48
 
49
49
  test 'currentuser_session returns currentuser session' do
50
- session[:currentuser] = {foo: 'blah'}
50
+ session[:currentuser] = {'foo' => 'blah'}
51
51
 
52
- assert_equal({foo: 'blah'}, @controller.currentuser_session)
52
+ assert_equal({'foo' => 'blah'}, @controller.currentuser_session)
53
53
  end
54
54
 
55
55
  # currentuser_id
56
56
 
57
57
  test 'currentuser_id returns currentuser ID' do
58
- session[:currentuser] = {id: 'user_id_1'}
58
+ session[:currentuser] = {'id' => 'user_id_1'}
59
59
 
60
60
  assert_equal 'user_id_1', @controller.currentuser_id
61
61
  end
@@ -38,8 +38,8 @@ module Currentuser
38
38
  end
39
39
 
40
40
  assert_redirected_to '/'
41
- assert_equal({id: user_id}, session[:currentuser])
42
- refute session[:currentuser].has_key?(:sign_up)
41
+ assert_equal({'id' => user_id}, session[:currentuser])
42
+ refute session[:currentuser].has_key?('sign_up')
43
43
  end
44
44
 
45
45
  test 'sign_in sets sign_up if sign_up is true' do
@@ -54,7 +54,7 @@ module Currentuser
54
54
  end
55
55
 
56
56
  assert_redirected_to '/'
57
- assert_equal true, session[:currentuser][:sign_up]
57
+ assert_equal true, session[:currentuser]['sign_up']
58
58
  end
59
59
 
60
60
  # This test proves that we use Services#check_authentication_params!
@@ -70,13 +70,13 @@ module Currentuser
70
70
  # sign_out
71
71
 
72
72
  test 'sign_out deletes session and redirects to root' do
73
- session_hash = {currentuser: {foo: :blah}, other_key: :other_value}
73
+ session_hash = {currentuser: {'foo' => 'blah'}, other_key: 'other_value'}
74
74
 
75
75
  delete_with_route :sign_out, {}, session_hash
76
76
  assert_redirected_to '/'
77
77
 
78
78
  assert_nil session[:currentuser]
79
- assert_equal :other_value, session[:other_key]
79
+ assert_equal 'other_value', session[:other_key]
80
80
  end
81
81
 
82
82
  # available
@@ -20,7 +20,7 @@ module TestRailsApp
20
20
  render inline: "
21
21
  Private page
22
22
  <%= button_to 'Sign out', 'currentuser/sign_out', method: :delete %>
23
- <% if currentuser_session[:sign_up] %>Sign Up<% end %>
23
+ <% if currentuser_session['sign_up'] %>Sign Up<% end %>
24
24
  "
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currentuser-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - eric-currentuser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-15 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config