我有点麻烦 - 不明白为什么我的 rspec 测试开始失败并且找不到 xml。它是使用this实现的。谁能帮我解决这个问题?
Rspec 测试:
response.status.should == 200
response.body.should have_xml('/PhoneBook/PhoneBookEntries/Contact/Id', @new_contact.id.to_s)
和控制台的输出:
Failure/Error: response.body.should have_xml('/PhoneBook/PhoneBookEntries/Contact/Id', @new_contact.id.to_s)
expected to find xml tag /PhoneBook/PhoneBookEntries/Contact/Id in:
<PhoneBook>
<APIVersion>1.0</APIVersion>
<SyncTime>1377192796</SyncTime>
<PhoneBookEntries>
<Contact>
<Id>182</Id>
<Avatar>
<type>PNG</type>
<data>iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQAAAACjtFqAAAAABGdBTUEAALGP
C/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUw
AADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAAHdihOkAAAACXBIWXMAAABIAAAA
SABGyWs+AAAAIklEQVRIx+3IMQEAAAwCIPuX1gJrMDhJD5FSSimllFLKfznP
BnQ17b9ZHAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0wOC0yMlQyMDozMzox
NiswMzowMDdI2UsAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTMtMDgtMjJUMjA6
MzM6MTYrMDM6MDBGFWH3AAAAAElFTkSuQmCC
</data>
<Modified>1377192796</Modified>
</Avatar>
</Contact>
<Contact>
<Id>183</Id>
<Avatar>
<type>PNG</type>
<data>iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQAAAACjtFqAAAAABGdBTUEAALGP
C/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUw
AADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAAHdihOkAAAACXBIWXMAAABIAAAA
SABGyWs+AAAAIklEQVRIx+3IMQEAAAwCIPuX1gJrMDhJD5FSSimllFLKfznP
BnQ17b9ZHAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0wOC0yMlQyMDozMzox
NiswMzowMDdI2UsAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTMtMDgtMjJUMjA6
MzM6MTYrMDM6MDBGFWH3AAAAAElFTkSuQmCC
</data>
<Modified>1345656796</Modified>
</Avatar>
</Contact>
</PhoneBookEntries>
</PhoneBook>