Module ThoughtBot::Shoulda::Controller::XML
In: lib/shoulda/controller_tests/formats/xml.rb

Methods

Classes and Modules

Module ThoughtBot::Shoulda::Controller::XML::ClassMethods

Public Instance methods

Asserts that the controller‘s response was ‘application/xml‘

[Source]

     # File lib/shoulda/controller_tests/formats/xml.rb, line 157
157:         def assert_xml_response
158:           content_type = (@response.headers["Content-Type"] || @response.headers["type"]).to_s
159:           regex = %r{\bapplication/xml\b}
160: 
161:           msg = "Content Type '#{content_type.inspect}' doesn't match '#{regex.inspect}'\n"
162:           msg += "Body: #{@response.body.first(100).chomp} ..." 
163: 
164:           assert_match regex, content_type, msg
165:         end

Sets the next request‘s format to ‘application/xml‘

[Source]

     # File lib/shoulda/controller_tests/formats/xml.rb, line 152
152:         def request_xml
153:           @request.accept = "application/xml"
154:         end

[Validate]