how do I pass XML file as paremeter in Integration test?
I am writi开发者_Go百科ng integration test in rails, for that I have to pass XML file as parameter, I tried the below way
test "integration" do
@controller = ApiController.new
file = "xxx/yyy.xml"
post "register_user",file
assert_true "something", @response.body
end
but it shows as below error,
NoMethodError: undefined method `symbolize_keys' for "/xxx/yyy.xml":String
Any one please help me...
You can also pass xml like this:
test "integration" do
@controller = ApiController.new
entry = <<-EOF
<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:gd='http://schemas.google.com/g/2005'>
</atom:entry>
EOF
url = URI.parse('http://www.example.com/todo.cgi')
req = Net::HTTP::Post.new(register_user, entry)
end
精彩评论