Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML response should have - text comparison with number input #35

Open
sytzek opened this issue Aug 19, 2015 · 2 comments
Open

XML response should have - text comparison with number input #35

sytzek opened this issue Aug 19, 2015 · 2 comments

Comments

@sytzek
Copy link

sytzek commented Aug 19, 2015

Using from api_step.rb the step:
the XML response should have "field" with the text "1234"

The string "1234" enters the body of the step as the argument named 'text'.
In the body the 'text' has class 'Fixnum' in stead of 'String.

The comparison between the element found and the text argument fails because the classes dont match.

Simple fix is to transform text explicitly to class String with the method 'to_s'

@sytzek
Copy link
Author

sytzek commented Aug 19, 2015

Hmm. the to_s method does not work with a string "0123" (it becomes "123")

@sytzek
Copy link
Author

sytzek commented Aug 19, 2015

This seems to work:

Add this step

Transform /^text "[^"]"$/ do |step_arg|
/text "([^"]
)"/.match(step_arg)[1]
end

And Change api_step to:

Then /^my XML response should have "([^"])" with the (text "[^"]")$/ do |xpath, text|
...
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant