human_error 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce3584e03d830added3a0b58d9fa67995aba2b62
4
- data.tar.gz: ce828a6fd224bc186e2da06ce1c007ea3cbad3fa
3
+ metadata.gz: ae7626c4412e2cb61249a059dffe4ce61a0a5781
4
+ data.tar.gz: 2d86051488201bfa3edb0ec68994d6025fd1316c
5
5
  SHA512:
6
- metadata.gz: 2383d7ae1f37c0ae716b39526cd6ade1365f09ffd9eaeb5784957e26f8cfa46e77c1593f64a0afc71c4e93627096d363887b31550125cfdd73be29d8b803ccb5
7
- data.tar.gz: cb3efadd3dd1f368b5889474b27ca8830bd971470b18c4888589f09bcbddae1877a133f1d903268d6f14647273cf038aeaa1daeb970adc1848d3cfc1c4183209
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
- "#{parameter} is a required parameter, but you did not supply it."
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
- "The following parameters passed are not allowed: #{parameters.join(', ')}"
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
@@ -1,3 +1,3 @@
1
1
  class HumanError
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.1'
3
3
  end
@@ -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 parameter: 'trenchcoat'
27
+ error = ParameterMissingError.new resource_name: 'trenchcoat',
28
+ action: 'create',
29
+ parameter: 'color'
28
30
 
29
- expect(error.detail).to eql 'trenchcoat is a required parameter, but you did not ' \
30
- 'supply it.'
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 parameters: 'trenchcoat'
27
+ error = UnpermittedParametersError.new resource_name: 'trenchcoat',
28
+ action: 'create',
29
+ parameters: 'color'
28
30
 
29
- expect(error.detail).to eql 'The following parameters passed are not allowed: ' \
30
- 'trenchcoat'
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 parameters: %w{trenchcoat matrix}
36
+ error = UnpermittedParametersError.new resource_name: 'trenchcoat',
37
+ action: 'create',
38
+ parameters: %w{color size}
35
39
 
36
- expect(error.detail).to eql 'The following parameters passed are not allowed: ' \
37
- 'trenchcoat, matrix'
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.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 00:00:00.000000000 Z
11
+ date: 2015-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec