registrar-rails 0.0.12.alpha → 0.0.13.alpha

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: 38b839959d1219301968e01491d6128cc7629008
4
- data.tar.gz: bad7edeed2429f57b69d9d841e52b423ae8586f0
3
+ metadata.gz: bfda5870a7c1a99c12972c5aa75a246ae111a3b4
4
+ data.tar.gz: 3375d6685f8d21aaa9eceb5b68b38131e9b5dedb
5
5
  SHA512:
6
- metadata.gz: 15e0845a502d1c70e9fe8ca87f3482ac8d567c3ef20f4f9335a557674ce1b316a6492d04717d25f13ee996350419a5772dcbc63174b6cf3c428aa2f8c6727932
7
- data.tar.gz: bb6f2053f3f8768bada0db3229e45f005131c5f6bb17fa8d9c955cd98182c014bd2344ad9014994814ec206e58bc6fb28878310122a687a3ecdf63ed530b06fe
6
+ metadata.gz: 998857c562890df19911e071b25599d153fb64689b46599dc4c145f65c73fe6bea7a5f7198778fa1b3f00176230a7cc0e5bfe93cd4d1e2b9e082ced66e095d7e
7
+ data.tar.gz: 2c59d47e9d3c7a259a86d949c052f58119402310c83664ed5d1c2309c714c8cc052673ccf8f6487cc9e1201b938485d36aa19f35af37303450ba6a32864a3a82
@@ -1,16 +1,5 @@
1
1
  module Registrar
2
2
  module Rails
3
- class CurrentProfile
4
- attr_reader :uid
5
- def initialize(uid)
6
- @uid = uid
7
- end
8
-
9
- def profile_uid
10
- @uid
11
- end
12
- end
13
-
14
3
  module ControllerExtensions
15
4
  def self.included(klass)
16
5
  klass.send :include, InstanceMethods
@@ -54,13 +43,22 @@ module Registrar
54
43
 
55
44
  if current_profile_uid
56
45
  @current_user = Registrar::Middleware::config.handler.call(
57
- Registrar::Rails::CurrentProfile.new(current_profile_uid)
46
+ build_current_profile
58
47
  )
59
48
  end
60
49
 
61
50
  @current_user
62
51
  end
63
52
 
53
+ def build_current_profile
54
+ {
55
+ "provider" => {
56
+ "name" => "session",
57
+ "uid" => current_profile_uid
58
+ }
59
+ }
60
+ end
61
+
64
62
  def current_profile?
65
63
  !!current_profile
66
64
  end
@@ -1,5 +1,5 @@
1
1
  module Registrar
2
2
  module Rails
3
- VERSION = "0.0.12.alpha"
3
+ VERSION = "0.0.13.alpha"
4
4
  end
5
5
  end
@@ -3,7 +3,8 @@ require 'test_helper'
3
3
  class CurrentProfileTest < ActionDispatch::IntegrationTest
4
4
  test 'exposes current profile if registrar.profile is avaliable' do
5
5
  get '/'
6
- current_profile_uid = response.body
7
- assert_equal '1', current_profile_uid
6
+ current_profile = JSON.parse(response.body)
7
+ expected = {"provider"=>{"name"=>"session", "uid"=>"1"}}
8
+ assert_equal expected, current_profile
8
9
  end
9
10
  end
@@ -1,5 +1,5 @@
1
1
  class SomeController < ApplicationController
2
2
  def index
3
- render :text => current_profile.uid
3
+ render :json => current_profile
4
4
  end
5
5
  end
@@ -841,3 +841,40 @@ Started GET "/" for 127.0.0.1 at 2015-06-01 16:55:41 +0200
841
841
  Processing by SomeController#index as HTML
842
842
  Rendered text template (0.0ms)
843
843
  Completed 200 OK in 17ms (Views: 2.7ms)
844
+ ----------------------------------------------------------------------------------
845
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
846
+ ----------------------------------------------------------------------------------
847
+ Started GET "/" for 127.0.0.1 at 2015-06-02 11:16:20 +0200
848
+ Processing by SomeController#index as HTML
849
+ Completed 500 Internal Server Error in 14ms
850
+ ----------------------------------------------------------------------------------
851
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
852
+ ----------------------------------------------------------------------------------
853
+ Started GET "/" for 127.0.0.1 at 2015-06-02 11:16:48 +0200
854
+ Processing by SomeController#index as HTML
855
+ Completed 500 Internal Server Error in 14ms
856
+ ----------------------------------------------------------------------------------
857
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
858
+ ----------------------------------------------------------------------------------
859
+ Started GET "/" for 127.0.0.1 at 2015-06-02 11:18:07 +0200
860
+ Processing by SomeController#index as HTML
861
+ Rendered text template (0.0ms)
862
+ Completed 200 OK in 17ms (Views: 3.0ms)
863
+ ----------------------------------------------------------------------------------
864
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
865
+ ----------------------------------------------------------------------------------
866
+ Started GET "/" for 127.0.0.1 at 2015-06-02 11:18:34 +0200
867
+ Processing by SomeController#index as HTML
868
+ Completed 200 OK in 14ms (Views: 0.1ms)
869
+ ----------------------------------------------------------------------------------
870
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
871
+ ----------------------------------------------------------------------------------
872
+ Started GET "/" for 127.0.0.1 at 2015-06-02 11:18:41 +0200
873
+ Processing by SomeController#index as HTML
874
+ Completed 200 OK in 14ms (Views: 0.1ms)
875
+ ----------------------------------------------------------------------------------
876
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
877
+ ----------------------------------------------------------------------------------
878
+ Started GET "/" for 127.0.0.1 at 2015-06-02 11:19:44 +0200
879
+ Processing by SomeController#index as HTML
880
+ Completed 200 OK in 14ms (Views: 0.2ms)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: registrar-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12.alpha
4
+ version: 0.0.13.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Owiesniak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails