shokkenki-provider 1.1.0 → 1.2.0

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.
@@ -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 { @actual_values = @actual_values.map{ |value| value[name] } }
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
- JsonPath.on(value, json_path.to_s)
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 'No matching values found' if @actual_values.empty?
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
@@ -1,7 +1,7 @@
1
1
  module Shokkenki
2
2
  module Provider
3
3
  module Version
4
- STRING = '1.1.0'
4
+ STRING = '1.2.0'
5
5
  end
6
6
  end
7
7
  end
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.1.0
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-02 00:00:00.000000000 Z
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: 3263124680721121205
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.1.0
216
+ summary: shokkenki-1.2.0
217
217
  test_files: []