dslh 0.4.3 → 0.4.4

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: ba8a8dcc743beceda02fefe5c864909276880831
4
- data.tar.gz: 60551002e3cc93d2d0e1a5ccc620a9ee722019ae
3
+ metadata.gz: 6aa60915bf85862de83b9abd47d17b13459a80e5
4
+ data.tar.gz: 1afa561b0b6173d9e51dbdf957031779954a9ba4
5
5
  SHA512:
6
- metadata.gz: 839419e273e655b10f0df3ba24470fdc16461e2605549d1f805a8a0b723e58c6db6f193815ee7d2f13b2d1f5bc57c000a0c2ab97c2f800efd85c5b4de5ad421f
7
- data.tar.gz: 03421bff73686c0d7d6e176f28295d1727333bf031965ae4454f57ed2fe3218e279c52f8bccd3718b3c9d175622c423ce866dc424aeb6b88c14cbf9e7bfdf811
6
+ metadata.gz: f6a77615c303d2d0e0c93c289a67355ca8ccfcbf04e02f29054015d5981763224506e9473b9b4fb0e544be01519aab3fbb69d0d0eb0b6d3d0d9ee0eb22c14dbc
7
+ data.tar.gz: 1c4210e22d3f2db47b23fe59eb2b3799d53bb0bd314276d5e1af26b6d39a8b9c765c4a37a0b5915476c961e87e9e12de017467b73f8776707575e0311883c215
@@ -6,10 +6,12 @@ require 'yaml'
6
6
  class Dslh
7
7
  class ValidationError < StandardError
8
8
  attr_reader :errors
9
+ attr_reader :data
9
10
 
10
- def initialize(root_errors)
11
+ def initialize(root_errors, data)
11
12
  super(root_errors.map {|e| e.to_s }.join("\n"))
12
13
  @errors = root_errors
14
+ @data = data
13
15
  end
14
16
  end
15
17
 
@@ -163,7 +165,7 @@ class Dslh
163
165
  end
164
166
 
165
167
  unless errors.empty?
166
- raise ValidationError, errors
168
+ raise ValidationError.new(errors, retval)
167
169
  end
168
170
  end
169
171
 
@@ -1,3 +1,3 @@
1
1
  class Dslh
2
- VERSION = '0.4.3'
2
+ VERSION = '0.4.4'
3
3
  end
@@ -3022,6 +3022,13 @@ mapping:
3022
3022
  errmsg = e.errors.map {|i| i.to_s }.join("\n")
3023
3023
  expect(errmsg).to eq expected_errmsg
3024
3024
  expect(e.message).to eq expected_errmsg
3025
+ expect(e.data).to eq(
3026
+ {"company"=>"winebarrel inc.",
3027
+ "email"=>"webmaster@winebarrel.com",
3028
+ "employees"=>
3029
+ [{"code"=>"foo", "name"=>101, "email"=>"foo@winebarrel.com"},
3030
+ {"code1"=>102, "name1"=>"bar", "email1"=>"bar@winebarrel.com"}]}
3031
+ )
3025
3032
  end
3026
3033
  end
3027
3034
  end
@@ -3190,6 +3197,13 @@ mapping:
3190
3197
  errmsg = e.errors.map {|i| i.to_s }.join("\n")
3191
3198
  expect(errmsg).to eq expected_errmsg
3192
3199
  expect(e.message).to eq expected_errmsg
3200
+ expect(e.data).to eq(
3201
+ {"employees"=>
3202
+ {123=>{"code"=>101, "email"=>"foo@winebarrel.com"},
3203
+ "bar"=>{"code"=>102, "email"=>100}},
3204
+ "employees2"=>{"foo2"=>{"code1"=>201, "email1"=>"foo@winebarrel.com"}},
3205
+ "employees3"=>{"bar2"=>{"code"=>202, "email"=>"bar@winebarrel.com"}}}
3206
+ )
3193
3207
  end
3194
3208
  end
3195
3209
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dslh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2016-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler