activerecord-typedstore 1.3.1 → 1.3.2

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
  SHA256:
3
- metadata.gz: 922ee9aa28151d4d9682563fb960a01e3f0b483d1c9d1e9168c095391b87344e
4
- data.tar.gz: 1116257100c7775ec75c3742666c9ab35454ceca71bef07781fe8581edaeeeec
3
+ metadata.gz: bdeb6337150bcfbc1307433960078b4ee4fa86930eea89ed1e27214df82b6d1a
4
+ data.tar.gz: 883fc7c802f2d86ca5a5c18133a75b8759907de917a938d765b3f55852338170
5
5
  SHA512:
6
- metadata.gz: 0c01c5370bc89c17b38a7f9a928e96064cececa214eb9e43a90a10b0ee8e990d18fbea8d18f1c45e1b1f3a9446d17174e79fe5483b1ae5a89ac5f5e994e618a8
7
- data.tar.gz: 99fc46ff54dd8ba238ef3bda41d2861d200fb8f11f41a5b07d0c5846d747435c3424a5f550c168c6f73a36c78638f6affbf95636f4a75c56af40ad8d42685268
6
+ metadata.gz: 989ac79c84da4898c175da31cef578c576396987c7356093430e116089e27c377f561f05a53872bd0adfb79c4ee4deae795f8d0ef0e67bc1b4f461ef04790e1b
7
+ data.tar.gz: a7f1e9fb20c79d5acd321140aad66d345c058155f2722d2afc9b25247615428b0286c8040d5c2a432a2f2d05b5a2666d2c773dbc56dcdfba9113d39f13901593
@@ -0,0 +1,47 @@
1
+ name: Ruby
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ name: Ruby ${{ matrix.ruby }}
9
+ strategy:
10
+ matrix:
11
+ ruby: [2.6, 2.7]
12
+ gemfile: [Gemfile.ar-5.2, Gemfile.ar-6.0, Gemfile.ar-6.1, Gemfile.ar-master]
13
+ exclude:
14
+ - ruby: 2.6
15
+ gemfile: Gemfile.ar-6.0
16
+ - ruby: 2.6
17
+ gemfile: Gemfile.ar-6.1
18
+ - ruby: 2.6
19
+ gemfile: Gemfile.ar-master
20
+ timezone_aware: [0, 1]
21
+ env:
22
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
23
+ TIMEZONE_AWARE: ${{ matrix.timezone_aware }}
24
+ POSTGRES: 1
25
+ MYSQL: 1
26
+ POSTGRES_JSON: 1
27
+ steps:
28
+ - name: Check out code
29
+ uses: actions/checkout@v2
30
+ - name: Set up Ruby ${{ matrix.ruby }}
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ bundler-cache: true
35
+ - name: Start MySQL and create DB
36
+ run: |
37
+ sudo systemctl start mysql.service
38
+ mysql -uroot -proot -e 'create database typed_store_test;'
39
+ - name: Start PostgresQL and create DB
40
+ run: |
41
+ sudo sed -i s/md5/trust/g /etc/postgresql/*/main/pg_hba.conf
42
+ sudo systemctl start postgresql.service
43
+ sudo -u postgres createuser --createdb --superuser ${USER}
44
+ createdb typed_store_test
45
+ echo "POSTGRES_URL=postgres://localhost/typed_store_test" >> $GITHUB_ENV
46
+ - name: Ruby Tests
47
+ run: bundle exec rake
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ ENV['PG_VERSION'] = '~> 1.1'
4
+ gemspec path: '..'
5
+
6
+ gem 'activerecord', '~> 6.1.0'
@@ -23,6 +23,7 @@ module ActiveRecord::TypedStore
23
23
 
24
24
  if ActiveRecord.version >= Gem::Version.new('6.1.0.alpha')
25
25
  attribute(store_attribute) do |subtype|
26
+ subtype = subtype.subtype if subtype.is_a?(Type)
26
27
  Type.new(typed_klass, dsl.coder, subtype)
27
28
  end
28
29
  else
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module TypedStore
5
- VERSION = '1.3.1'
5
+ VERSION = '1.3.2'
6
6
  end
7
7
  end
@@ -854,3 +854,17 @@ describe MarshalTypedStoreModel do
854
854
  it_should_behave_like 'a store'
855
855
  it_should_behave_like 'a model supporting arrays'
856
856
  end
857
+
858
+ describe InheritedTypedStoreModel do
859
+ let(:model) { described_class.new }
860
+
861
+ it 'can be serialized' do
862
+ model.update(new_attribute: "foobar")
863
+ expect(model.reload.new_attribute).to be == "foobar"
864
+ end
865
+
866
+ it 'is casted' do
867
+ model.update(new_attribute: 42)
868
+ expect(model.settings[:new_attribute]).to be == '42'
869
+ end
870
+ end
@@ -6,7 +6,7 @@ ActiveRecord::Base.time_zone_aware_attributes = ENV['TIMEZONE_AWARE'] != '0'
6
6
  ActiveRecord::Base.configurations = {
7
7
  'test_sqlite3' => { 'adapter' => 'sqlite3', 'database' => '/tmp/typed_store.db' },
8
8
  'test_postgresql' => { 'adapter' => 'postgresql', 'database' => 'typed_store_test', 'username' => 'postgres' },
9
- 'test_mysql' => { 'adapter' => 'mysql2', 'database' => 'typed_store_test', 'username' => 'travis' },
9
+ 'test_mysql' => { 'adapter' => 'mysql2', 'database' => 'typed_store_test', 'username' => 'root', 'password' => 'root' },
10
10
  }
11
11
 
12
12
  def define_columns(t)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-typedstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-28 00:00:00.000000000 Z
11
+ date: 2021-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -143,9 +143,9 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
+ - ".github/workflows/ruby.yml"
146
147
  - ".gitignore"
147
148
  - ".rspec"
148
- - ".travis.yml"
149
149
  - Gemfile
150
150
  - LICENSE.txt
151
151
  - README.md
@@ -154,6 +154,7 @@ files:
154
154
  - gemfiles/Gemfile.ar-5.0
155
155
  - gemfiles/Gemfile.ar-5.2
156
156
  - gemfiles/Gemfile.ar-6.0
157
+ - gemfiles/Gemfile.ar-6.1
157
158
  - gemfiles/Gemfile.ar-master
158
159
  - lib/active_record/typed_store.rb
159
160
  - lib/active_record/typed_store/behavior.rb
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  - !ruby/object:Gem::Version
190
191
  version: '0'
191
192
  requirements: []
192
- rubygems_version: 3.1.2
193
+ rubygems_version: 3.1.4
193
194
  signing_key:
194
195
  specification_version: 4
195
196
  summary: Add type casting and full method attributes support to АctiveRecord store
data/.travis.yml DELETED
@@ -1,34 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
-
5
- before_install:
6
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
7
- - gem install bundler -v '< 2'
8
-
9
- rvm:
10
- - "2.5"
11
- - "2.6"
12
- gemfile:
13
- - gemfiles/Gemfile.ar-5.2
14
- - gemfiles/Gemfile.ar-6.0
15
- - gemfiles/Gemfile.ar-master
16
-
17
- env:
18
- - TIMEZONE_AWARE=1 POSTGRES=1 MYSQL=1 POSTGRES_JSON=1
19
- - TIMEZONE_AWARE=0 POSTGRES=1 MYSQL=1 POSTGRES_JSON=1
20
-
21
- matrix:
22
- exclude:
23
- - rvm: "2.6"
24
- gemfile: 'gemfiles/Gemfile.6-0'
25
- - rvm: "2.6"
26
- gemfile: 'gemfiles/Gemfile.ar-master'
27
-
28
- services:
29
- - mysql
30
- - postgresql
31
-
32
- before_script:
33
- - mysql -e 'create database typed_store_test;'
34
- - psql -c 'create database typed_store_test;' -U postgres