shokkenki-provider 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
2
|
+
|
1
3
|
module Shokkenki
|
2
4
|
module Provider
|
3
5
|
module RSpec
|
@@ -6,7 +8,13 @@ module Shokkenki
|
|
6
8
|
def verify_within context
|
7
9
|
value.each do |name, term|
|
8
10
|
context.describe name do
|
9
|
-
before
|
11
|
+
before do
|
12
|
+
@actual_values = @actual_values.map do |value|
|
13
|
+
extracted_value = value.with_indifferent_access[name]
|
14
|
+
self.send(:fail, %Q{No value for "#{name}" found in #{@actual_values.join(', ')}}) unless extracted_value
|
15
|
+
extracted_value
|
16
|
+
end
|
17
|
+
end
|
10
18
|
|
11
19
|
term.verify_within self
|
12
20
|
end
|
@@ -10,13 +10,17 @@ module Shokkenki
|
|
10
10
|
context.describe 'json' do
|
11
11
|
term.value.each do |json_path, term|
|
12
12
|
describe json_path do
|
13
|
-
|
14
13
|
before(:each) do
|
14
|
+
original_values = @actual_values
|
15
15
|
@actual_values = @actual_values.map do |value|
|
16
|
-
|
16
|
+
begin
|
17
|
+
JsonPath.on(value, json_path.to_s)
|
18
|
+
rescue Exception => e
|
19
|
+
self.send(:fail, "#{e} in JSON #{original_values.join(', ')}")
|
20
|
+
end
|
17
21
|
end.flatten
|
18
22
|
|
19
|
-
fail
|
23
|
+
self.send(:fail, "Path \"#{json_path.to_s}\" not found in JSON #{original_values.join(', ')}") if @actual_values.empty?
|
20
24
|
end
|
21
25
|
|
22
26
|
term.verify_within self
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shokkenki-provider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -207,11 +207,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: '0'
|
208
208
|
segments:
|
209
209
|
- 0
|
210
|
-
hash:
|
210
|
+
hash: -538937335424908313
|
211
211
|
requirements: []
|
212
212
|
rubyforge_project:
|
213
213
|
rubygems_version: 1.8.23
|
214
214
|
signing_key:
|
215
215
|
specification_version: 3
|
216
|
-
summary: shokkenki-1.
|
216
|
+
summary: shokkenki-1.2.0
|
217
217
|
test_files: []
|