sequel_validation_helpers_block 1.1.0 → 1.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e62b9f5e44d0d74e6a4623425677893a205789bc
|
4
|
+
data.tar.gz: 9eeb416f21d50fad396a26c09e66ec4aae22f27d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f599be7b062b2f793572646f5255b6057e2bdd6adea0cbb44896a02e6386ae6e322129934f96afa52ae8414aeb50529b2ac5e737b980f9cc2a2a106df8e6d3c
|
7
|
+
data.tar.gz: 6607a33b82264ac18791bd7967a3da7ecc7c2af861a74f0e2e2afff2dd3f36cf5f30186232e8ed7fea1f33ffedd561db246a76c4ed3d4968ac8af65ad75cd363
|
data/LICENSE
CHANGED
File without changes
|
@@ -1,22 +1,10 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'sequel'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
if defined?(RSpec)
|
7
|
-
require 'rspec/version'
|
8
|
-
if RSpec::Version::STRING >= '2.11.0'
|
9
|
-
RSpec.configure do |config|
|
10
|
-
config.expect_with :rspec do |c|
|
11
|
-
c.syntax = :should
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'minitest/autorun'
|
16
4
|
|
17
5
|
describe "Sequel::Plugins::ValidationHelpersBlock" do
|
18
6
|
before do
|
19
|
-
@db = Sequel
|
7
|
+
@db = Sequel.mock
|
20
8
|
@c = Class.new(Sequel::Model(@db)) do
|
21
9
|
def self.set_validations(&block)
|
22
10
|
define_method(:validate, &block)
|
@@ -43,13 +31,13 @@ describe "Sequel::Plugins::ValidationHelpersBlock" do
|
|
43
31
|
end
|
44
32
|
end
|
45
33
|
end
|
46
|
-
@m.
|
47
|
-
@m.errors.
|
34
|
+
@m.wont_be :valid?
|
35
|
+
@m.errors.must_equal(:name=>["is not present", "is not present"], :date=>["is invalid"], :number=>["is not present", "is not a number"])
|
48
36
|
@m.set(:name=>'1234567890-', :number=>'a', :date=>'Tuesday')
|
49
|
-
@m.
|
50
|
-
@m.errors.
|
37
|
+
@m.wont_be :valid?
|
38
|
+
@m.errors.must_equal(:name=>["is longer than 10 characters"], :date=>["is invalid"], :number=>["is not a number"])
|
51
39
|
@m.set(:name=>'1234', :number=>'10', :date=>'10/11/2009')
|
52
|
-
@m.
|
40
|
+
@m.must_be :valid?
|
53
41
|
end
|
54
42
|
|
55
43
|
specify "should accept options for validation methods" do
|
@@ -66,14 +54,14 @@ describe "Sequel::Plugins::ValidationHelpersBlock" do
|
|
66
54
|
end
|
67
55
|
end
|
68
56
|
end
|
69
|
-
@m.
|
70
|
-
@m.errors.
|
57
|
+
@m.must_be :valid?
|
58
|
+
@m.errors.must_equal({})
|
71
59
|
@m.set(:name=>' ', :number=>nil)
|
72
|
-
@m.
|
73
|
-
@m.errors.
|
60
|
+
@m.must_be :valid?
|
61
|
+
@m.errors.must_equal({})
|
74
62
|
@m.set(:name=>' 12 ', :number=>'', :date=>nil)
|
75
|
-
@m.
|
76
|
-
@m.errors.
|
63
|
+
@m.wont_be :valid?
|
64
|
+
@m.errors.must_equal(:name=>["cannot be more than 10 characters"], :date=>["is invalid"], :number=>["is not a number"])
|
77
65
|
end
|
78
66
|
|
79
67
|
specify "should support all validation_helpers methods" do
|
@@ -101,7 +89,7 @@ describe "Sequel::Plugins::ValidationHelpersBlock" do
|
|
101
89
|
end
|
102
90
|
ds = @db.dataset
|
103
91
|
ds.extend(Module.new {
|
104
|
-
def columns
|
92
|
+
def columns
|
105
93
|
[:name, :date, :number]
|
106
94
|
end
|
107
95
|
|
@@ -112,13 +100,13 @@ describe "Sequel::Plugins::ValidationHelpersBlock" do
|
|
112
100
|
@c.dataset = ds
|
113
101
|
@c.db_schema[:name] = {:type => :string}
|
114
102
|
@m.name = ''
|
115
|
-
@m.
|
116
|
-
@m.errors.
|
103
|
+
@m.wont_be :valid?
|
104
|
+
@m.errors.must_equal(:name=>["is already taken", "is not 10 characters", "is shorter than 8 characters", "is too short or too long"], :date=>["is invalid", "is not in range or set: [\"10/11/2009\"]"], :number=>["is not present", "is not a number", "is not a number"])
|
117
105
|
@m.set(:name=>'123456789', :date=>'10/12/2009', :number=>'12')
|
118
|
-
@m.
|
119
|
-
@m.errors.
|
106
|
+
@m.wont_be :valid?
|
107
|
+
@m.errors.must_equal(:name=>["is already taken", "is not 10 characters"], :date=>["is not in range or set: [\"10/11/2009\"]"])
|
120
108
|
@m.set(:name=>'1234567890', :date=>'10/11/2009', :number=>12)
|
121
|
-
@m.
|
122
|
-
@m.errors.
|
109
|
+
@m.must_be :valid?
|
110
|
+
@m.errors.must_equal({})
|
123
111
|
end
|
124
112
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel_validation_helpers_block
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sequel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.12.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.12.0
|
13
27
|
description:
|
14
28
|
email: code@jeremyevans.net
|
15
29
|
executables: []
|
@@ -17,7 +31,7 @@ extensions: []
|
|
17
31
|
extra_rdoc_files: []
|
18
32
|
files:
|
19
33
|
- LICENSE
|
20
|
-
- lib/
|
34
|
+
- lib/sequel/plugins/validation_helpers_block.rb
|
21
35
|
- spec/sequel_validation_helpers_block_spec.rb
|
22
36
|
homepage: https://github.com/jeremyevans/sequel_validation_helpers_block
|
23
37
|
licenses:
|
@@ -32,7 +46,7 @@ rdoc_options:
|
|
32
46
|
rules apply to a given column, at the expense of increased verbosity'
|
33
47
|
- "--main"
|
34
48
|
- Sequel::Plugins::ValidationHelpersBlock
|
35
|
-
- lib/
|
49
|
+
- lib/sequel/plugins/validation_helpers_block.rb
|
36
50
|
- LICENSE
|
37
51
|
require_paths:
|
38
52
|
- lib
|
@@ -48,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
62
|
version: '0'
|
49
63
|
requirements: []
|
50
64
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.6.11
|
52
66
|
signing_key:
|
53
67
|
specification_version: 4
|
54
68
|
summary: Allows easy determination of which validation rules apply to a given column,
|