| Module | ThoughtBot::Shoulda::Controller::XML::ClassMethods |
| In: |
lib/shoulda/controller/formats/xml.rb
|
Macro that creates a test asserting that the controller responded with an XML content-type and that the XML contains +<name/>+ as the root element.
# File lib/shoulda/controller/formats/xml.rb, line 14
14: def should_respond_with_xml_for(name = nil)
15: should "have ContentType set to 'application/xml'" do
16: assert_xml_response
17: end
18:
19: if name
20: should "return <#{name}/> as the root element" do
21: body = @response.body.first(100).map {|l| " #{l}"}
22: assert_select name.to_s.dasherize, 1, "Body:\n#{body}...\nDoes not have <#{name}/> as the root element."
23: end
24: end
25: end