stark_parameters 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/stark_parameters/version.rb +1 -1
- data/lib/stark_parameters.rb +1 -1
- data/spec/lib/stark_parameters_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWE2MGVlODNmMDkxMWIxYzA1NDA0MWZjMGQ4YTJiODljMDZiZTJjYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODk4N2ZmZWE3MGE0NWFhN2Y4ZmMzZThmMjVjOGYwNjI3YjI2OTg3OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWJjOWMwMGYwZmE0MzRkZjU5OGE5ODBiMDhjYWQyYTIwYjFhMDFiZDAzOWYy
|
10
|
+
YmU1ZDQ3Y2QwZjhiYzU3OGExYWZmMmEwODBiYTVmYjhkZTQwMmJkZTkzYzY4
|
11
|
+
YjBmMjhjZjU3ZmFjNTg3MWNmMTA0YTFmYWI4ZDIzYTMwNThkZTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTViN2VhMzI0Y2MyZjg4NTZiZmFjM2VmMGI3MzkyMzY2MjI3M2Q5Mjk2M2Jm
|
14
|
+
NWM4MmY0N2NiNjFiNGVhODQwMjIzOGVhNmQxNzAyZTgzMGI4ZjU0MWMwZGRj
|
15
|
+
MjM1ZDVmNzQ3MjcyNmVmOGZiNjAwMjUyYzE2MDBkNmU2NzNmYzY=
|
data/lib/stark_parameters.rb
CHANGED
@@ -32,7 +32,7 @@ module StarkParameters
|
|
32
32
|
permitted_key = permitted_param.is_a?(Hash) ? permitted_param.keys.first : permitted_param
|
33
33
|
name = self.class.aliases[permitted_key] || permitted_key
|
34
34
|
permitted_value = respond_to?(name) ? send(name) : @params.permit(permitted_param)[name]
|
35
|
-
hash[name] = permitted_value
|
35
|
+
hash[name] = permitted_value if @params.has_key?(permitted_key)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -127,4 +127,17 @@ describe StarkParameters do
|
|
127
127
|
let(:validator) { test_klass.new({}) }
|
128
128
|
it { expect(validator.params.to_hash).to include("foo" => "bar") }
|
129
129
|
end
|
130
|
+
|
131
|
+
context "with empty permitted value" do
|
132
|
+
let(:test_klass) do
|
133
|
+
Class.new do
|
134
|
+
include StarkParameters
|
135
|
+
|
136
|
+
permit :foo
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
let(:validator) { test_klass.new({foo: nil}) }
|
141
|
+
it { expect(validator.params.to_hash).to include("foo" => nil) }
|
142
|
+
end
|
130
143
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stark_parameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rylev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|