stark_parameters 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stark_parameters.rb +6 -2
- data/lib/stark_parameters/version.rb +1 -1
- data/spec/lib/stark_parameters_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- data/stark_parameters.gemspec +1 -1
- metadata +2 -3
- data/.bundle/install.log +0 -29
data/lib/stark_parameters.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
|
1
|
+
require "active_support/all"
|
2
|
+
require "rack"
|
3
|
+
require "rack/test"
|
4
|
+
require "action_controller/metal/strong_parameters"
|
2
5
|
|
6
|
+
module StarkParameters
|
3
7
|
def self.included(klass)
|
4
8
|
klass.send :extend, ClassMethods
|
5
9
|
klass.required_params = []
|
@@ -14,7 +18,7 @@ module StarkParameters
|
|
14
18
|
end
|
15
19
|
|
16
20
|
def params
|
17
|
-
make_strong_parameter(permitted_params.merge(required_params))
|
21
|
+
make_strong_parameter(permitted_params.merge(required_params)).permit!
|
18
22
|
end
|
19
23
|
|
20
24
|
private
|
@@ -35,6 +35,8 @@ describe StarkParameters do
|
|
35
35
|
it { expect(validator.params.to_hash).to include("author" => { "id" => 1, "name" => "Steve" }) }
|
36
36
|
it { expect(validator.params.to_hash).to include("login" => "ryan@6wunderkinder.com") }
|
37
37
|
it { expect(validator.params.to_hash.keys).to_not include("email") }
|
38
|
+
|
39
|
+
it { expect(validator.params.permitted?).to be_true }
|
38
40
|
end
|
39
41
|
|
40
42
|
context "when required param is missing" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require "stark_parameters"
|
2
|
-
require "
|
2
|
+
require "rack/test"
|
data/stark_parameters.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_dependency '
|
20
|
+
gem.add_dependency 'actionpack'
|
21
21
|
|
22
22
|
gem.add_development_dependency 'rake'
|
23
23
|
gem.add_development_dependency 'rspec'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stark_parameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ cert_chain: []
|
|
12
12
|
date: 2014-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: actionpack
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
@@ -66,7 +66,6 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
- .bundle/install.log
|
70
69
|
- .gitignore
|
71
70
|
- Gemfile
|
72
71
|
- LICENSE.txt
|
data/.bundle/install.log
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Logfile created on 2014-03-11 14:48:55 +0100 by logger.rb/31641
|
2
|
-
I, [2014-03-11T14:48:55.511655 #30778] INFO -- : 0: rake (10.1.1) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rake-10.1.1.gemspec
|
3
|
-
I, [2014-03-11T14:48:55.512455 #30778] INFO -- : 0: i18n (0.6.9) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/i18n-0.6.9.gemspec
|
4
|
-
I, [2014-03-11T14:48:55.513137 #30778] INFO -- : 0: multi_json (1.9.0) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/multi_json-1.9.0.gemspec
|
5
|
-
I, [2014-03-11T14:48:57.734092 #30778] INFO -- : 0: activesupport (3.2.17) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/activesupport-3.2.17.gemspec
|
6
|
-
I, [2014-03-11T14:48:57.734649 #30778] INFO -- : 0: builder (3.0.4) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/builder-3.0.4.gemspec
|
7
|
-
I, [2014-03-11T14:48:59.627458 #30778] INFO -- : 0: activemodel (3.2.17) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/activemodel-3.2.17.gemspec
|
8
|
-
I, [2014-03-11T14:48:59.628237 #30778] INFO -- : 0: erubis (2.7.0) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/erubis-2.7.0.gemspec
|
9
|
-
I, [2014-03-11T14:48:59.628729 #30778] INFO -- : 0: journey (1.0.4) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/journey-1.0.4.gemspec
|
10
|
-
I, [2014-03-11T14:48:59.629323 #30778] INFO -- : 0: rack (1.4.5) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rack-1.4.5.gemspec
|
11
|
-
I, [2014-03-11T14:48:59.630046 #30778] INFO -- : 0: rack-cache (1.2) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rack-cache-1.2.gemspec
|
12
|
-
I, [2014-03-11T14:48:59.630637 #30778] INFO -- : 0: rack-test (0.6.2) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rack-test-0.6.2.gemspec
|
13
|
-
I, [2014-03-11T14:48:59.631292 #30778] INFO -- : 0: hike (1.2.3) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/hike-1.2.3.gemspec
|
14
|
-
I, [2014-03-11T14:48:59.631972 #30778] INFO -- : 0: tilt (1.4.1) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/tilt-1.4.1.gemspec
|
15
|
-
I, [2014-03-11T14:48:59.632640 #30778] INFO -- : 0: sprockets (2.2.2) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/sprockets-2.2.2.gemspec
|
16
|
-
I, [2014-03-11T14:49:01.473503 #30778] INFO -- : 0: actionpack (3.2.17) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/actionpack-3.2.17.gemspec
|
17
|
-
I, [2014-03-11T14:49:01.474060 #30778] INFO -- : 0: diff-lcs (1.2.5) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/diff-lcs-1.2.5.gemspec
|
18
|
-
I, [2014-03-11T14:49:01.474420 #30778] INFO -- : 0: json (1.8.1) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/json-1.8.1.gemspec
|
19
|
-
I, [2014-03-11T14:49:01.474753 #30778] INFO -- : 0: rack-ssl (1.3.3) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rack-ssl-1.3.3.gemspec
|
20
|
-
I, [2014-03-11T14:49:01.475088 #30778] INFO -- : 0: rdoc (3.12.2) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rdoc-3.12.2.gemspec
|
21
|
-
I, [2014-03-11T14:49:01.475418 #30778] INFO -- : 0: thor (0.18.1) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/thor-0.18.1.gemspec
|
22
|
-
I, [2014-03-11T14:49:03.970720 #30778] INFO -- : 0: railties (3.2.17) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/railties-3.2.17.gemspec
|
23
|
-
I, [2014-03-11T14:49:05.795065 #30778] INFO -- : 0: rspec-core (2.14.8) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rspec-core-2.14.8.gemspec
|
24
|
-
I, [2014-03-11T14:49:05.795698 #30778] INFO -- : 0: rspec-expectations (2.14.5) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rspec-expectations-2.14.5.gemspec
|
25
|
-
I, [2014-03-11T14:49:05.796160 #30778] INFO -- : 0: rspec-mocks (2.14.6) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rspec-mocks-2.14.6.gemspec
|
26
|
-
I, [2014-03-11T14:49:05.796544 #30778] INFO -- : 0: rspec (2.14.1) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/rspec-2.14.1.gemspec
|
27
|
-
I, [2014-03-11T14:49:05.796917 #30778] INFO -- : 0: strong_parameters (0.2.3) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/strong_parameters-0.2.3.gemspec
|
28
|
-
I, [2014-03-11T14:49:05.813289 #30778] INFO -- : 0: stark parameters (0.0.1) from /Users/ryanlevick/Sites/personal/stark-parameters/stark_parameters.gemspec
|
29
|
-
I, [2014-03-11T14:49:05.813731 #30778] INFO -- : 0: bundler (1.5.1) from /Users/ryanlevick/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/specifications/bundler-1.5.1.gemspec
|