weak_parameters 0.4.1 → 0.4.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
  SHA1:
3
- metadata.gz: cc43dbf15b3f5fe477fe58c0788a80aa036317f5
4
- data.tar.gz: d6a24136ebea5ade178a61d4555e376128d95432
3
+ metadata.gz: a52940d7977000d245a95b87b5f22af91aa4b5c3
4
+ data.tar.gz: 33eced881c79f06410b1a1d62f2afcafc00a003d
5
5
  SHA512:
6
- metadata.gz: 7b716fa12192074d863010d6b25369e1d00ec03571ae7e4872f40bba877373f1964f670790518f51a640ccac0bb742e53206625a77f9ea0a639de67b49a7452c
7
- data.tar.gz: 6f8a71f1741499f9f0acde74dc8f0ea6a1fbb673679beaf8101c7a314f674d5c90f87a3731b83bd37994994d936d8d5bc85b623d2f0d61ed88d4b505dc862f3d
6
+ metadata.gz: 66a4a668aad0a88ccfa96cb8a3ed6fa6dfaab0c5fbcf6a3b449d0ad1581385a7621e5e8f76639bfd29a6ae652308b175d4bf9321fd42915862e416a9ba9bd92d
7
+ data.tar.gz: 998d553643a47651bac8df5a7fb0ca69e6c18e5ffc4aad8cdc5c17f62b0861565eb1b2f1b8f634ce003da1a1562e6deb637b1625b83c3493cbf7f142fe716aff
@@ -1,74 +1,102 @@
1
+ ## 0.4.2
2
+
3
+ - Fix options on list validator (Thx @laboone)
4
+
1
5
  ## 0.4.1
6
+
2
7
  - Support rails-api
3
8
 
4
9
  ## 0.4.0
10
+
5
11
  - Support Rails 5
6
12
 
7
13
  ## 0.3.0
14
+
8
15
  - Remove Rails 3 support
9
16
 
10
17
  ## 0.2.3
18
+
11
19
  - Change execution context of validator block
12
20
  - Fix a development dependencies problem
13
21
 
14
22
  ## 0.2.2
23
+
15
24
  - Fix nil validation bug on nested parameters (Thx @mzp)
16
25
 
17
26
  ## 0.2.1
27
+
18
28
  - Fix validtion bug on existence check
19
29
 
20
30
  ## 0.2.0
31
+
21
32
  - Add strong options on validator DSL (Thx @yoshiori)
22
33
 
23
34
  ## 0.1.7
35
+
24
36
  - Fix bug on missing `@path` variable (Thx @taka0125)
25
37
 
26
38
  ## 0.1.6
39
+
27
40
  - Support nested parameters (Thx @mzp)
28
41
 
29
42
  ## 0.1.5
43
+
30
44
  - Support `file` validator (#6)
31
45
 
32
46
  ## 0.1.4
47
+
33
48
  - Tiny improvement about Validator#params
34
49
 
35
50
  ## 0.1.3
51
+
36
52
  - Don't directly touch AC::Base, but do it via AS.on_load
37
53
 
38
54
  ## 0.1.2
55
+
39
56
  - Add `:handler` option to customize failure behavior
40
57
  - Fix bug around `float` validator with block
41
58
 
42
59
  ## 0.1.1
60
+
43
61
  - Add `any` validator
44
62
 
45
63
  ## 0.1.0
64
+
46
65
  - Add type checking to `string` validator
47
66
 
48
67
  ## 0.0.9
68
+
49
69
  - Improve error message
50
70
 
51
71
  ## 0.0.8
72
+
52
73
  - Add block support to all validators
53
74
  - Add `float` validator
54
75
 
55
76
  ## 0.0.7
77
+
56
78
  - Fix `integer` validator bug
57
79
 
58
80
  ## 0.0.6
81
+
59
82
  - Change value handling in `:only` & `:except` checking
60
83
 
61
84
  ## 0.0.5
85
+
62
86
  - Add `:only` & `:except` options
63
87
 
64
88
  ## 0.0.4
89
+
65
90
  - Fix stored controller name for namespaced controller
66
91
 
67
92
  ## 0.0.3
93
+
68
94
  - Fix type name bug
69
95
 
70
96
  ## 0.0.2
97
+
71
98
  - Add `hash` & `boolean` validator
72
99
 
73
100
  ## 0.0.1
101
+
74
102
  - Release the first version on 2013-06-07
@@ -1,8 +1,8 @@
1
1
  module WeakParameters
2
2
  class ListValidator < WeakParameters::ArrayValidator
3
3
  attr_reader :validator
4
- def initialize(controller, key, validator)
5
- super controller, key, {}
4
+ def initialize(controller, key, validator, options)
5
+ super controller, key, options
6
6
  @validator = validator
7
7
  end
8
8
 
@@ -76,7 +76,7 @@ module WeakParameters
76
76
 
77
77
  def list(key, type, options = {}, &block)
78
78
  children = with_validators { send type, nil, options, &block }
79
- validators << WeakParameters::ListValidator.new(controller, key, children.first)
79
+ validators << WeakParameters::ListValidator.new(controller, key, children.first, options)
80
80
  end
81
81
  end
82
82
  end
@@ -1,3 +1,3 @@
1
1
  module WeakParameters
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -20,7 +20,7 @@ module WithRecipe
20
20
  integer :number, only: [0, 1]
21
21
  end
22
22
 
23
- list :numbers, :integer, description: 'some numbers'
23
+ list :numbers, :integer, required: true, description: 'some numbers'
24
24
 
25
25
  object :body do
26
26
  list :items, :object, description: 'some items' do
@@ -42,10 +42,19 @@ describe "Recipes with rails-api", type: :request do
42
42
 
43
43
  describe "POST /api/recipes" do
44
44
  context "without required param" do
45
- before do
46
- params.delete(:name)
45
+ describe 'string parameter' do
46
+ before do
47
+ params.delete(:name)
48
+ end
49
+ include_examples "400"
50
+ end
51
+
52
+ describe 'list parameter' do
53
+ before do
54
+ params.delete(:numbers)
55
+ end
56
+ include_examples "400"
47
57
  end
48
- include_examples "400"
49
58
  end
50
59
 
51
60
  context "with wrong string param" do
@@ -42,10 +42,19 @@ describe "Recipes", type: :request do
42
42
 
43
43
  describe "POST /recipes" do
44
44
  context "without required param" do
45
- before do
46
- params.delete(:name)
45
+ describe 'string parameter' do
46
+ before do
47
+ params.delete(:name)
48
+ end
49
+ include_examples "400"
50
+ end
51
+
52
+ describe 'list parameter' do
53
+ before do
54
+ params.delete(:numbers)
55
+ end
56
+ include_examples "400"
47
57
  end
48
- include_examples "400"
49
58
  end
50
59
 
51
60
  context "with wrong string param" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weak_parameters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-09 00:00:00.000000000 Z
11
+ date: 2017-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  requirements: []
221
221
  rubyforge_project:
222
- rubygems_version: 2.4.5.1
222
+ rubygems_version: 2.5.2
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: Add a validation filter to your controller.