dry-validation-matchers 0.2.0 → 0.3.0

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: fa11af6eff8f312ab0a780ff97982e5ab3f6996d
4
- data.tar.gz: 73ab136c45063a1e077c94dbfc58f7647e8db3cb
3
+ metadata.gz: e683c7835e3bdb494ff818f193966dc2a8cc4db3
4
+ data.tar.gz: 3255c6fec6c3ed488f14d66ca13af1edf2c07919
5
5
  SHA512:
6
- metadata.gz: f6e5358d83f4c74661a60056791b8c07527387ec600aaa43d8cfd1c27d557d0afc5c14b6855d4ce9a9fd3ea2719f023e3a5ec753ab7da0deac6ea2712e20db79
7
- data.tar.gz: 33d00a86047db198f7aa50f03a5f1dc13d66ba4f4cad5123bf8d74a06f8a941b6d6a8f6b6943064b992e3907aae0697e814155e0a8d08b809b415e8c4ac82787
6
+ metadata.gz: 4e59cf54eb8b8377fcb5c15caa216bd6fe6526d9b05174263bf8bc4e2df934114743a238cd107b6538ff08b416b2f190b3f84fc8bc0d5d412bb305006c2f83e5
7
+ data.tar.gz: 4b6985fbfe900d657f0f9816b79e36b3c1ffa50a5577845fb28d967f79ae6faaaadbdfa2bf3051282899de0ec51ff9eaa256f26b8871bbb976dbacfcb40dcde8
@@ -1,9 +1,13 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- The format is based on [Keep a Changelog](http://keepachangelog.com/)
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [0.3.0] - 2016-11-09
8
+ ### Added
9
+ - Add support for float, decimal, bool, date, time, date_time, array, hash
10
+
7
11
  ## [0.2.0] - 2016-11-08
8
12
  ### Added
9
13
  - failure_message
data/README.md CHANGED
@@ -23,22 +23,24 @@ Or install it yourself as:
23
23
  ## Usage
24
24
 
25
25
  ```ruby
26
- subject(:schema_class) do
27
- Class.new(Dry::Validation::Schema) do
28
- define! do
29
- required(:username).filled
30
- required(:first_name)
31
- required(:age).filled(:int?)
32
- required(:last_name).filled(:str?)
33
- optional(:mobile).filled
34
- optional(:email)
26
+ RSpec.describe "SomeSchema class", type: [:dry_validation]
27
+ subject(:schema_class) do
28
+ Class.new(Dry::Validation::Schema) do
29
+ define! do
30
+ required(:username).filled
31
+ required(:first_name)
32
+ required(:age).filled(:int?)
33
+ required(:last_name).filled(:str?)
34
+ optional(:mobile).filled
35
+ optional(:email)
36
+ end
35
37
  end
36
38
  end
37
- end
38
39
 
39
- it { is_expected.to validate(:username, :required).filled }
40
- it { is_expected.to validate(:mobile, :optional).filled }
41
- it { is_expected.to validate(:email, :optional) }
40
+ it { is_expected.to validate(:username, :required).filled }
41
+ it { is_expected.to validate(:mobile, :optional).filled }
42
+ it { is_expected.to validate(:email, :optional) }
43
+ end
42
44
  ```
43
45
 
44
46
  See `spec/acceptance/rspec_spec.rb` as well.
@@ -11,6 +11,38 @@ module Dry::Validation::Matchers
11
11
  test_value: 43,
12
12
  message: "must be an integer",
13
13
  },
14
+ float: {
15
+ test_value: 41.5,
16
+ message: "must be a float",
17
+ },
18
+ decimal: {
19
+ test_value: BigDecimal.new("41.5"),
20
+ message: "must be a decimal",
21
+ },
22
+ bool: {
23
+ test_value: false,
24
+ message: "must be a boolean",
25
+ },
26
+ date: {
27
+ test_value: Date.new(2011, 1, 2),
28
+ message: "must be a date",
29
+ },
30
+ time: {
31
+ test_value: Time.new(2011, 1, 2, 2, 33),
32
+ message: "must be a time",
33
+ },
34
+ date_time: {
35
+ test_value: DateTime.new(2011, 5, 1, 2, 3, 4),
36
+ message: "must be a date_time",
37
+ },
38
+ array: {
39
+ test_value: [1, 3, 5],
40
+ message: "must be a array",
41
+ },
42
+ hash: {
43
+ test_value: {hello: "there"},
44
+ message: "must be a hash",
45
+ },
14
46
  }
15
47
 
16
48
  def initialize(attr, acceptance)
@@ -1,7 +1,7 @@
1
1
  module Dry
2
2
  module Validation
3
3
  module Matchers
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-validation-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-08 00:00:00.000000000 Z
11
+ date: 2016-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport