activerecord-databasevalidations 0.2.4 → 0.2.5

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: 34dc53f04bf08ea073fef57188664b90956b8321
4
- data.tar.gz: 1572b1ea15781c21c1ae70c46c3a5ff92732139a
3
+ metadata.gz: 8c11efae478930073f88dc28f6b2475f8c7007b6
4
+ data.tar.gz: 2007c8ba0229680b0fcffd2037d9e3de6ea24477
5
5
  SHA512:
6
- metadata.gz: 0eb07eaee9796217e129a10e1cd955fa48bfd97faa3eb4566331ae46a72c018376bec8b40a3756a42f9e2371d6c2c8e4806921aec74602e0e0992915a5b9b0dc
7
- data.tar.gz: 00911b2ddf02fcb8acf37c42b9faa3e4fba6aa60f79d4086427f9ef2ed636f96e4d6039cf1ee71d2344a2225d086620934f7948f7315d3774f0237179e719bc9
6
+ metadata.gz: 1964dd60bb60504b4d8340915de87fcd6bb03804a542f24b67094fbf59ef3f1c71d3a3beffc99289eafccfec44bc23226ffe03c751a912fec7dbe1a9936228df
7
+ data.tar.gz: 63af8cccba1e2df89e6734f174eec31702b4f1b73e5c8574daf9896c19496148cc3d6bdf06ecaac3a8c56e6764b217e2f38f66badb91cf83dddc535ff60f1c65
@@ -1,13 +1,31 @@
1
+ sudo: false
1
2
  language: ruby
3
+ cache: bundler
2
4
 
3
5
  rvm:
4
6
  - 1.9.3
5
7
  - 2.0.0
6
- - 2.1.3
8
+ - 2.1.8
9
+ - 2.2.4
10
+ - 2.3.0
7
11
 
8
12
  gemfile:
9
13
  - Gemfile.activerecord40
10
14
  - Gemfile.activerecord41
15
+ - Gemfile.activerecord42
16
+ - Gemfile.activerecord50
17
+
18
+ matrix:
19
+ exclude:
20
+ - rvm: 1.9.3
21
+ gemfile: Gemfile.activerecord50
22
+ - rvm: 2.0.0
23
+ gemfile: Gemfile.activerecord50
24
+ - rvm: 2.1.8
25
+ gemfile: Gemfile.activerecord50
26
+
27
+ allow_failures:
28
+ - gemfile: Gemfile.activerecord50
11
29
 
12
30
  before_script:
13
31
  - mysql -e 'create database database_validations;'
@@ -0,0 +1 @@
1
+
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'activerecord', '~> 4.0.0'
5
+ gem 'mysql2', '< 0.4'
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'activerecord', '~> 4.1.0'
5
+ gem 'mysql2', '< 0.4'
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem 'activerecord', '~> 4.2.0'
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem 'activerecord', github: 'rails/rails'
data/README.md CHANGED
@@ -6,6 +6,8 @@ This gem is primarily intended for MySQL databases not running in strict mode,
6
6
  which can easily cause data loss. These problems are documented in
7
7
  [DataLossTest](https://github.com/wvanbergen/activerecord-databasevalidations/blob/master/test/data_loss_test.rb)
8
8
 
9
+ Should be thread-safe. Please submit an issue or PR if you can prove otherwise.
10
+
9
11
  ## Installation
10
12
 
11
13
  Add this line to your application's Gemfile:
@@ -61,7 +63,7 @@ You can also instantiate the validators yourself:
61
63
 
62
64
  ``` ruby
63
65
  class Bar < ActiveRecord::Base
64
- validates :string_field, bytesize: { maximum: 255}, basic_multilingual_plane: true
66
+ validates :string_field, bytesize: { maximum: 255 }, basic_multilingual_plane: true
65
67
  validates :string_field, not_null: true
66
68
  end
67
69
  ```
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "activerecord", "~> 4.0"
21
+ spec.add_runtime_dependency "activerecord", ">= 4.0", "< 5.1"
22
22
  spec.add_runtime_dependency "rejectu"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.5"
@@ -18,17 +18,14 @@ module ActiveRecord
18
18
  }
19
19
 
20
20
  def self.column_size_limit(column)
21
- @column_size_limit ||= {}
22
- @column_size_limit[column] ||= begin
23
- column_type = column.sql_type.sub(/\(.*\z/, '').gsub(/\s/, '_').to_sym
24
- type_limit = TYPE_LIMITS.fetch(column_type, {})
21
+ column_type = column.sql_type.sub(/\(.*\z/, '').gsub(/\s/, '_').to_sym
22
+ type_limit = TYPE_LIMITS.fetch(column_type, {})
25
23
 
26
- [
27
- column.limit || type_limit[:maximum],
28
- type_limit[:type],
29
- determine_encoding(column),
30
- ]
31
- end
24
+ [
25
+ column.limit || type_limit[:maximum],
26
+ type_limit[:type],
27
+ determine_encoding(column),
28
+ ]
32
29
  end
33
30
 
34
31
  def self.column_range(column)
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module DatabaseValidations
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
@@ -18,6 +18,8 @@ module DataLossAssertions
18
18
 
19
19
  persisted_values = record.reload.attributes.slice(*attributes)
20
20
  refute_equal provided_values, persisted_values
21
+ rescue RangeError
22
+ pass
21
23
  end
22
24
 
23
25
  def refute_data_loss(record)
metadata CHANGED
@@ -1,97 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-databasevalidations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '4.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.1'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rejectu
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - '>='
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: '0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - '>='
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
46
  version: '0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ~>
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
53
  version: '1.5'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ~>
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: '1.5'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - '>='
65
+ - - ">="
60
66
  - !ruby/object:Gem::Version
61
67
  version: '0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - '>='
72
+ - - ">="
67
73
  - !ruby/object:Gem::Version
68
74
  version: '0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: minitest
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - '>='
79
+ - - ">="
74
80
  - !ruby/object:Gem::Version
75
81
  version: '0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - '>='
86
+ - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: mysql2
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
- - - '>='
93
+ - - ">="
88
94
  - !ruby/object:Gem::Version
89
95
  version: '0'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
- - - '>='
100
+ - - ">="
95
101
  - !ruby/object:Gem::Version
96
102
  version: '0'
97
103
  description: Opt-in validations for your ActiveRecord models based on your MySQL database
@@ -102,11 +108,14 @@ executables: []
102
108
  extensions: []
103
109
  extra_rdoc_files: []
104
110
  files:
105
- - .gitignore
106
- - .travis.yml
111
+ - ".gitignore"
112
+ - ".travis.yml"
113
+ - CHANGELOG.md
107
114
  - Gemfile
108
115
  - Gemfile.activerecord40
109
116
  - Gemfile.activerecord41
117
+ - Gemfile.activerecord42
118
+ - Gemfile.activerecord50
110
119
  - LICENSE.txt
111
120
  - README.md
112
121
  - Rakefile
@@ -143,17 +152,17 @@ require_paths:
143
152
  - lib
144
153
  required_ruby_version: !ruby/object:Gem::Requirement
145
154
  requirements:
146
- - - '>='
155
+ - - ">="
147
156
  - !ruby/object:Gem::Version
148
157
  version: '0'
149
158
  required_rubygems_version: !ruby/object:Gem::Requirement
150
159
  requirements:
151
- - - '>='
160
+ - - ">="
152
161
  - !ruby/object:Gem::Version
153
162
  version: '0'
154
163
  requirements: []
155
164
  rubyforge_project:
156
- rubygems_version: 2.0.14
165
+ rubygems_version: 2.5.1
157
166
  signing_key:
158
167
  specification_version: 4
159
168
  summary: Add validations to your ActiveRecord models based on MySQL database constraints.