public
Rubygem
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/thoughtbot/shoulda.git
fixed xml content type detection

git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@289 
7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
tsaleh (author)
Mon Jan 21 06:49:53 -0800 2008
commit  e1af92ed2f73d869c35a7b4c61e938ee390cf335
tree    0434d55884c7882de67550d284a828a62763088e
parent  99cf8cad5d288e0b0346dc4e4a83a6b5fdb5d32a
...
155
156
157
158
 
 
 
 
 
 
 
 
 
159
160
161
...
155
156
157
 
158
159
160
161
162
163
164
165
166
167
168
169
0
@@ -155,7 +155,15 @@ module ThoughtBot # :nodoc:
0
         
0
         # Asserts that the controller's response was 'application/xml'
0
         def assert_xml_response
0
- assert_equal "application/xml", @response.content_type, "Body: #{@response.body.first(100).chomp}..."
0
+ content_type = (@response.headers["Content-Type"] || @response.headers["type"]).to_s
0
+ regex = %r{\bapplication/xml\b}
0
+
0
+ msg = "Content Type '#{content_type.inspect}' doesn't match '#{regex.inspect}'\n"
0
+ msg += "Body: #{@response.body.first(100).chomp} ..."
0
+
0
+ assert_match regex, content_type, msg
0
+
0
+ # assert_equal "application/xml", @response.content_type, "Body: #{@response.body.first(100).chomp}..."
0
         end
0
         
0
       end

Comments

    No one has commented yet.