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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51f285cee8313b61091d5a50a53db46f7cc1b1d0
4
- data.tar.gz: 97d3a518b97e27bc1b88b1c6a284761294985509
3
+ metadata.gz: 4a10d28d1fedc2265c21778bc396a9290d873634
4
+ data.tar.gz: 10443cf7641573095ca36b799a09bb460740b428
5
5
  SHA512:
6
- metadata.gz: 7eb43ccae8429f25005c3dde06c4b1fe0c46d66df96ec107066129b49aedb728b2e9ecbf4a1c0ec084f0da5cb911d7aded13a959ff9aa7994e1cc20a30c1ab84
7
- data.tar.gz: 108b16fdeda54aa27e3989b79012073632a305058808671954ad86bc95719b99bf3914b57ab253dada81efb7a16c91821bf9e9ca954f4a2bd6f7380e000ed9be
6
+ metadata.gz: f63c30ce3c389a79648fc265591e0976fd2f3d45b6568f190fff16068f3b0c26ad3edca2fcbea87f2ea7ccd6de97a4e27ea436f06d07b97c9b7dd9f8e8eb9ef1
7
+ data.tar.gz: 58530920dd4a349f99f19683551bab09b9a8a5a58b247317a7e785e7df1774b97edc2edb83735cdbbeffa5395d486121ac83e61e37dddd62446941a4682f4b86
@@ -2,4 +2,4 @@ before_install:
2
2
  - gem update bundler
3
3
  language: ruby
4
4
  rvm:
5
- - 2.2.0
5
+ - 2.2.3
@@ -1,3 +1,6 @@
1
+ ## 0.4.0
2
+ - Support Rails 5
3
+
1
4
  ## 0.3.0
2
5
  - Remove Rails 3 support
3
6
 
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rails", "4.0.0"
5
+ gem "rails", "5.0.0"
@@ -3,7 +3,12 @@ module WeakParameters
3
3
  private
4
4
 
5
5
  def valid_type?
6
- value.is_a?(Hash)
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
@@ -1,3 +1,3 @@
1
1
  module WeakParameters
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -1,8 +1,6 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
3
 
4
- respond_to :json
5
-
6
4
  rescue_from WeakParameters::ValidationError do
7
5
  head 400
8
6
  end
@@ -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
 
@@ -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.3.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-19 00:00:00.000000000 Z
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: