开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜