weak_parameters 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -1
- data/lib/weak_parameters/hash_validator.rb +6 -1
- data/lib/weak_parameters/version.rb +1 -1
- data/spec/dummy/app/controllers/application_controller.rb +0 -2
- data/spec/dummy/config/environments/test.rb +0 -1
- data/spec/requests/recipes_spec.rb +3 -3
- data/spec/requests/strong_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a10d28d1fedc2265c21778bc396a9290d873634
|
4
|
+
data.tar.gz: 10443cf7641573095ca36b799a09bb460740b428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f63c30ce3c389a79648fc265591e0976fd2f3d45b6568f190fff16068f3b0c26ad3edca2fcbea87f2ea7ccd6de97a4e27ea436f06d07b97c9b7dd9f8e8eb9ef1
|
7
|
+
data.tar.gz: 58530920dd4a349f99f19683551bab09b9a8a5a58b247317a7e785e7df1774b97edc2edb83735cdbbeffa5395d486121ac83e61e37dddd62446941a4682f4b86
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -3,7 +3,12 @@ module WeakParameters
|
|
3
3
|
private
|
4
4
|
|
5
5
|
def valid_type?
|
6
|
-
|
6
|
+
type = if Object.const_defined?(:ActionController) && ActionController.const_defined?(:StrongParameters)
|
7
|
+
ActionController::Parameters
|
8
|
+
else
|
9
|
+
Hash
|
10
|
+
end
|
11
|
+
value.is_a?(type)
|
7
12
|
end
|
8
13
|
|
9
14
|
def error_message
|
@@ -9,7 +9,6 @@ Dummy::Application.configure do
|
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
11
|
config.serve_static_assets = true
|
12
|
-
config.static_cache_control = "public, max-age=3600"
|
13
12
|
|
14
13
|
# Show full error reports and disable caching
|
15
14
|
config.consider_all_requests_local = true
|
@@ -28,14 +28,14 @@ describe "Recipes", type: :request do
|
|
28
28
|
|
29
29
|
shared_examples_for "400" do
|
30
30
|
it "returns 400" do
|
31
|
-
post "/recipes", params
|
31
|
+
post "/recipes", params: params
|
32
32
|
expect(response.status).to eq(400)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
shared_examples_for "201" do
|
37
37
|
it "creates a new recipe" do
|
38
|
-
post "/recipes", params
|
38
|
+
post "/recipes", params: params
|
39
39
|
expect(response.status).to eq(201)
|
40
40
|
end
|
41
41
|
end
|
@@ -141,7 +141,7 @@ describe "Recipes", type: :request do
|
|
141
141
|
params[:custom] = "invalid"
|
142
142
|
end
|
143
143
|
it "delegates to specified method" do
|
144
|
-
post "/recipes", params
|
144
|
+
post "/recipes", params: params
|
145
145
|
expect(response.status).to eq(403)
|
146
146
|
end
|
147
147
|
end
|
@@ -48,7 +48,7 @@ describe "Strong", type: :request do
|
|
48
48
|
|
49
49
|
describe "#permitted_params" do
|
50
50
|
it "returns permitted_params" do
|
51
|
-
post "/strongs", params
|
51
|
+
post "/strongs", params: params
|
52
52
|
expect(controller.permitted_params).to have_key "strong_object"
|
53
53
|
expect(controller.permitted_params).not_to have_key "object"
|
54
54
|
|
data/spec/spec_helper.rb
CHANGED
@@ -3,11 +3,6 @@ require File.expand_path("../../spec/dummy/config/environment", __FILE__)
|
|
3
3
|
require "rspec/rails"
|
4
4
|
|
5
5
|
RSpec.configure do |config|
|
6
|
-
# If you"re not using ActiveRecord, or you"d prefer not to run each of your
|
7
|
-
# examples within a transaction, remove the following line or assign false
|
8
|
-
# instead of true.
|
9
|
-
config.use_transactional_fixtures = true
|
10
|
-
|
11
6
|
# If true, the base class of anonymous controllers will be inferred
|
12
7
|
# automatically. This will be the default behavior in future versions of
|
13
8
|
# rspec-rails.
|
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
|
+
version: 0.4.0
|
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-02
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
version: '0'
|
213
213
|
requirements: []
|
214
214
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.4.5
|
215
|
+
rubygems_version: 2.4.5.1
|
216
216
|
signing_key:
|
217
217
|
specification_version: 4
|
218
218
|
summary: Add a validation filter to your controller.
|
@@ -256,4 +256,3 @@ test_files:
|
|
256
256
|
- spec/requests/recipes_spec.rb
|
257
257
|
- spec/requests/strong_spec.rb
|
258
258
|
- spec/spec_helper.rb
|
259
|
-
has_rdoc:
|