cucumber-api-steps 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,13 +43,23 @@ Then /^the response status should be "([^\"]*)"$/ do |status|
43
43
  end
44
44
 
45
45
  Then /^the JSON response should have "([^\"]*)" with the text "([^\"]*)"$/ do |json_path, text|
46
- json = JSON.parse(page.driver.last_response.body)
47
- JsonPath.new(json_path).on(json).to_a.map(&:to_s).should include(text)
46
+ json = JSON.parse(page.driver.last_response.body)
47
+ results = JsonPath.new(json_path).on(json).to_a.map(&:to_s)
48
+ if page.respond_to? :should
49
+ results.should include(text)
50
+ else
51
+ assert results.include?(text)
52
+ end
48
53
  end
49
54
 
50
55
  Then /^the JSON response should not have "([^\"]*)" with the text "([^\"]*)"$/ do |json_path, text|
51
- json = JSON.parse(page.driver.last_response.body)
52
- JsonPath.new(json_path).on(json).to_a.map(&:to_s).should_not include(text)
56
+ json = JSON.parse(page.driver.last_response.body)
57
+ results = JsonPath.new(json_path).on(json).to_a.map(&:to_s)
58
+ if page.respond_to? :should
59
+ results.should_not include(text)
60
+ else
61
+ assert !results.include?(text)
62
+ end
53
63
  end
54
64
 
55
65
  Then /^the XML response should have "([^\"]*)" with the text "([^\"]*)"$/ do |xpath, text|
@@ -1,5 +1,5 @@
1
1
  module Cucumber
2
2
  module ApiSteps
3
- VERSION = "0.1"
3
+ VERSION = "0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-api-steps
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jay Zeschin