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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzM2YTU1MzI1YzAyNzZhYzVlOWVhMThiN2NlNGVkOGNiNTdmMjgyMQ==
4
+ ZWE2MGVlODNmMDkxMWIxYzA1NDA0MWZjMGQ4YTJiODljMDZiZTJjYw==
5
5
  data.tar.gz: !binary |-
6
- NWQ0MzljZGIxYTMzMzBlNTI2ZjY3YWIwM2Y3NjY2NWIzN2JjY2JjNg==
6
+ ODk4N2ZmZWE3MGE0NWFhN2Y4ZmMzZThmMjVjOGYwNjI3YjI2OTg3OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2Y1NmZiZjgyZjQyNjZlZDJiNDIxZTU0ODk5MzFhY2EwNDRlMDc5NzNiOTU0
10
- NmJhNjdjZTlmYmE0MDNjOTM2ZWZiNWQyNDNjNGU4M2U3ZmI4MDUwZGQwYjA4
11
- ZmMzMmNiM2Y2N2M2YjYyMDFiOWNlMDM2ZDYwZjEwMWUxMDZmNjM=
9
+ OWJjOWMwMGYwZmE0MzRkZjU5OGE5ODBiMDhjYWQyYTIwYjFhMDFiZDAzOWYy
10
+ YmU1ZDQ3Y2QwZjhiYzU3OGExYWZmMmEwODBiYTVmYjhkZTQwMmJkZTkzYzY4
11
+ YjBmMjhjZjU3ZmFjNTg3MWNmMTA0YTFmYWI4ZDIzYTMwNThkZTk=
12
12
  data.tar.gz: !binary |-
13
- ZjcwNzRkNGUwNTAwNjdhMTFhMzI3ODUwYzhmYTJjY2QxNjYxYTRlNmQxYTY3
14
- ZGQ1MDk2MmVhYmE4ZGQwM2QyZWJmNWZlYzUwOThiYzYxNDZiMjE0MzUwZTcz
15
- YTFlYjhiOTI5ZmZkN2EzOTlhNWJmNjFkOGQ3ODU1ZjljNDEwN2M=
13
+ MTViN2VhMzI0Y2MyZjg4NTZiZmFjM2VmMGI3MzkyMzY2MjI3M2Q5Mjk2M2Jm
14
+ NWM4MmY0N2NiNjFiNGVhODQwMjIzOGVhNmQxNzAyZTgzMGI4ZjU0MWMwZGRj
15
+ MjM1ZDVmNzQ3MjcyNmVmOGZiNjAwMjUyYzE2MDBkNmU2NzNmYzY=
@@ -1,3 +1,3 @@
1
1
  module StarkParameters
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -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 unless permitted_value.nil?
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.3
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-06-02 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack