activerecord-postgresql-extensions 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 884595fe6ca7f7decbe13587cfd320816f6fe1aa
4
- data.tar.gz: e655d1e1363ce3089488c383a1a86bf5dc7ac2a1
3
+ metadata.gz: 20a8f5a52e70f2af6ab1cedf38917ad34062b99d
4
+ data.tar.gz: 6711b30dcc29cc0a7caac8834c92c99629617845
5
5
  SHA512:
6
- metadata.gz: 1982f5f26ac5b40052c3d7a92000e6594c0a1d9b44c828e802c6f91623a106428129d74316529b9591754560254ce32f788558984f46f5bf35c95c5d0958b7ae
7
- data.tar.gz: b3b04fa975238f7381d3f324d32bd195601fd7c38506983be39fafbe2c8656567ff12e4750459fed4f8de5a7ff2e2516cfa4c6a65e814fe7937397403f68cdc7
6
+ metadata.gz: 3e5975fb6a7986f0b20a4d176bf591602388bb1d45a3d7fe6fcfdfe3e0c580d46d59c2d4d72b5642b5f742bc3788858406a090d464508bd1f5204a54b2330133
7
+ data.tar.gz: dc10116eaa8817788546e12583089a62dd00e858794bbbc3e2628ff3a2435aa68d558903f13316212fd53d339f235d1d3650c6440146fba8ffb9b07e241269cd
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Zoocasa, Brokerage <code@zoocasa.com>
1
+ Copyright (c) 2010-2016 J Smith <dark.panda@gmail.com>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
@@ -443,7 +443,11 @@ module ActiveRecord
443
443
  end
444
444
 
445
445
  def current_role
446
- execute('SELECT current_role;')
446
+ current_role = execute('SELECT current_role;').try(:first)
447
+
448
+ if current_role
449
+ current_role['current_user']
450
+ end
447
451
  end
448
452
  alias :current_user :current_role
449
453
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  module ActiveRecord
3
3
  module PostgreSQLExtensions
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0".freeze
5
5
  end
6
6
  end
7
7
 
@@ -71,13 +71,20 @@ class AdapterExtensionTests < PostgreSQLExtensionsTestCase
71
71
  end
72
72
 
73
73
  def test_current_role
74
- ARBC.current_role
75
- ARBC.current_user
74
+ ARBC.real_execute do
75
+ current_role = ARBC.current_role
76
+ current_user = ARBC.current_user
76
77
 
77
- assert_equal([
78
- 'SELECT current_role;',
79
- 'SELECT current_role;'
80
- ], statements)
78
+ assert_equal([
79
+ 'SELECT current_role;',
80
+ 'SELECT current_role;'
81
+ ], statements)
82
+
83
+ real_user = ARBC.execute('SELECT current_role;').first['current_user']
84
+
85
+ assert_equal(real_user, current_user);
86
+ assert_equal(real_user, current_role);
87
+ end
81
88
  end
82
89
 
83
90
  def test_enable_triggers
metadata CHANGED
@@ -1,24 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgresql-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - J Smith
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2016-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activerecord
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '2.3'
20
- type: :runtime
19
+ name: activerecord
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
@@ -94,7 +94,7 @@ homepage: http://github.com/zoocasa/activerecord-postgresql-extensions
94
94
  licenses:
95
95
  - MIT
96
96
  metadata: {}
97
- post_install_message:
97
+ post_install_message:
98
98
  rdoc_options: []
99
99
  require_paths:
100
100
  - lib
@@ -109,9 +109,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.4.6
114
- signing_key:
112
+ rubyforge_project:
113
+ rubygems_version: 2.4.8
114
+ signing_key:
115
115
  specification_version: 4
116
116
  summary: A whole bunch of extensions the ActiveRecord PostgreSQL adapter.
117
117
  test_files: