stark_parameters 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/stark_parameters.rb
CHANGED
@@ -7,8 +7,10 @@ module StarkParameters
|
|
7
7
|
klass.aliases = {}
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(params)
|
11
|
-
@params = make_strong_parameter(
|
10
|
+
def initialize(*params)
|
11
|
+
@params = params.each_with_object(make_strong_parameter({})) do |p, hash|
|
12
|
+
hash.merge!(make_strong_parameter(p))
|
13
|
+
end
|
12
14
|
end
|
13
15
|
|
14
16
|
def params
|
@@ -49,4 +49,10 @@ describe StarkParameters do
|
|
49
49
|
it { expect{ validator.params }.to_not raise_error }
|
50
50
|
it { expect(validator.params.to_hash.keys).to_not include("author") }
|
51
51
|
end
|
52
|
+
|
53
|
+
context "with multiple params" do
|
54
|
+
let(:validator) { test_klass.new(full_params.except("name"), {"name" => "Ryan"}) }
|
55
|
+
|
56
|
+
it { expect(validator.params.to_hash).to include("name" => "Ryan") }
|
57
|
+
end
|
52
58
|
end
|