cucumber-api-steps 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ require 'jsonpath'
2
+
1
3
  World(Rack::Test::Methods)
2
4
 
3
5
  Given /^I send and accept XML$/ do
@@ -42,7 +44,7 @@ Then /^the response status should be "([^\"]*)"$/ do |status|
42
44
  if page.respond_to? :should
43
45
  page.driver.last_response.status.should == status.to_i
44
46
  else
45
- assert page.driver.last_response.status == status.to_i
47
+ assert_equal status.to_i, page.driver.last_response.status
46
48
  end
47
49
  end
48
50
 
@@ -69,6 +71,11 @@ end
69
71
  Then /^the XML response should have "([^\"]*)" with the text "([^\"]*)"$/ do |xpath, text|
70
72
  parsed_response = Nokogiri::XML(last_response.body)
71
73
  elements = parsed_response.xpath(xpath)
72
- elements.should_not be_empty, "could not find #{xpath} in:\n#{last_response.body}"
73
- elements.find { |e| e.text == text }.should_not be_nil, "found elements but could not find #{text} in:\n#{elements.inspect}"
74
+ if page.respond_to? :should
75
+ elements.should_not be_empty, "could not find #{xpath} in:\n#{last_response.body}"
76
+ elements.find { |e| e.text == text }.should_not be_nil, "found elements but could not find #{text} in:\n#{elements.inspect}"
77
+ else
78
+ assert !elements.empty?, "could not find #{xpath} in:\n#{last_response.body}"
79
+ assert elements.find { |e| e.text == text }, "found elements but could not find #{text} in:\n#{elements.inspect}"
80
+ end
74
81
  end
@@ -1,5 +1,5 @@
1
1
  module Cucumber
2
2
  module ApiSteps
3
- VERSION = "0.3"
3
+ VERSION = "0.4"
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: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- version: "0.3"
8
+ - 4
9
+ version: "0.4"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jay Zeschin