human_error 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/human_error/errors/request_errors/parameter_missing_error.rb +3 -1
- data/lib/human_error/errors/request_errors/unpermitted_parameters_error.rb +3 -1
- data/lib/human_error/version.rb +1 -1
- data/spec/lib/human_error/errors/request_errors/parameter_missing_error_spec.rb +5 -3
- data/spec/lib/human_error/errors/request_errors/unpermitted_parameters_error_spec.rb +10 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae7626c4412e2cb61249a059dffe4ce61a0a5781
|
4
|
+
data.tar.gz: 2d86051488201bfa3edb0ec68994d6025fd1316c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b5a792a22cb283d12e9170cb50c5f91c9efbcde54c1b94d8950b37e2860a585716a669ecc54a92634869b4996801a081b72ec86f656cdb5d6f6ee8635f4b6f5
|
7
|
+
data.tar.gz: 0883edbf5941bfc16d7aa86f41d192130c2ddc0c82e6da88515214b36789aab72e77a4720296c67dbd657f66c7ce716a9d7be9eca2cc353c86b193d8e9b15cf5
|
@@ -2,6 +2,7 @@ class HumanError
|
|
2
2
|
module Errors
|
3
3
|
class ParameterMissingError < RuntimeError
|
4
4
|
include Error
|
5
|
+
include CrudError
|
5
6
|
|
6
7
|
attr_accessor :parameter
|
7
8
|
|
@@ -27,7 +28,8 @@ class ParameterMissingError < RuntimeError
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def detail
|
30
|
-
"#{
|
31
|
+
"When attempting to #{action} a #{resource_name}, '#{parameter}' is a " \
|
32
|
+
'required parameter.'
|
31
33
|
end
|
32
34
|
|
33
35
|
def source
|
@@ -2,6 +2,7 @@ class HumanError
|
|
2
2
|
module Errors
|
3
3
|
class UnpermittedParametersError < RuntimeError
|
4
4
|
include Error
|
5
|
+
include CrudError
|
5
6
|
|
6
7
|
attr_accessor :parameters
|
7
8
|
|
@@ -33,7 +34,8 @@ class UnpermittedParametersError < RuntimeError
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def detail
|
36
|
-
"
|
37
|
+
"Attempting to #{action} a #{resource_name} with the following parameters is " \
|
38
|
+
"not allowed: #{parameters.join(', ')}"
|
37
39
|
end
|
38
40
|
|
39
41
|
def source
|
data/lib/human_error/version.rb
CHANGED
@@ -24,10 +24,12 @@ describe ParameterMissingError do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'includes the resource name and action in the detail' do
|
27
|
-
error = ParameterMissingError.new
|
27
|
+
error = ParameterMissingError.new resource_name: 'trenchcoat',
|
28
|
+
action: 'create',
|
29
|
+
parameter: 'color'
|
28
30
|
|
29
|
-
expect(error.detail).to eql
|
30
|
-
'
|
31
|
+
expect(error.detail).to eql "When attempting to create a trenchcoat, 'color' is " \
|
32
|
+
'a required parameter.'
|
31
33
|
end
|
32
34
|
|
33
35
|
it 'includes the resource name and action in the source' do
|
@@ -24,17 +24,21 @@ describe UnpermittedParametersError do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'includes the resource name and action in the detail' do
|
27
|
-
error = UnpermittedParametersError.new
|
27
|
+
error = UnpermittedParametersError.new resource_name: 'trenchcoat',
|
28
|
+
action: 'create',
|
29
|
+
parameters: 'color'
|
28
30
|
|
29
|
-
expect(error.detail).to eql '
|
30
|
-
'
|
31
|
+
expect(error.detail).to eql 'Attempting to create a trenchcoat with the ' \
|
32
|
+
'following parameters is not allowed: color'
|
31
33
|
end
|
32
34
|
|
33
35
|
it 'includes the resource name and action in the detail' do
|
34
|
-
error = UnpermittedParametersError.new
|
36
|
+
error = UnpermittedParametersError.new resource_name: 'trenchcoat',
|
37
|
+
action: 'create',
|
38
|
+
parameters: %w{color size}
|
35
39
|
|
36
|
-
expect(error.detail).to eql '
|
37
|
-
'
|
40
|
+
expect(error.detail).to eql 'Attempting to create a trenchcoat with the ' \
|
41
|
+
'following parameters is not allowed: color, size'
|
38
42
|
end
|
39
43
|
|
40
44
|
it 'includes the resource name and action in the source' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: human_error
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jfelchner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|