public
Description: Custom controller spec macros, with an included 'custom_scaffold' generator.
Clone URL: git://github.com/technoweenie/rspec_on_rails_on_crack.git
better error messages for status and content type
technoweenie (author)
Thu Jun 12 11:49:37 -0700 2008
commit  4915806206e6f9d0d3ee8488edc4a60978894d93
tree    54c5cb33ea1081b693918467fcce0d1f3bb7fdb5
parent  674f21ecd97d8554f98fc96cdd78d3ae83394aa1
...
107
108
109
110
 
111
112
113
114
115
116
117
 
118
119
120
121
 
122
123
124
...
107
108
109
 
110
111
112
113
114
115
116
 
117
118
119
120
 
121
122
123
124
0
@@ -107,18 +107,18 @@ module RspecOnRailsOnCrack
0
     protected
0
       def asserts_content_type(type = :html)
0
         mime = Mime::Type.lookup_by_extension((type || :html).to_s)
0
- violated "Renders with Content-Type of #{mime}" unless response.content_type == mime
0
+ violated "Renders with Content-Type of #{response.content_type}, not #{mime}" unless response.content_type == mime
0
       end
0
       
0
       def asserts_status(status)
0
         case status
0
         when String, Fixnum
0
           code = ActionController::StatusCodes::STATUS_CODES[status.to_i]
0
- violated "Renders with status of #{response.code.inspect}" unless response.code == status.to_s
0
+ violated "Renders with status of #{response.code.inspect}, not #{status}" unless response.code == status.to_s
0
         when Symbol
0
           code_value = ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE[status]
0
           code = ActionController::StatusCodes::STATUS_CODES[code_value]
0
- violated "Renders with status of #{response.code.inspect}" unless response.code == code_value.to_s
0
+ violated "Renders with status of #{response.code.inspect}, not #{code.inspect}" unless response.code == code_value.to_s
0
         else
0
           violated "Is not successful" unless response.success?
0
         end

Comments

    No one has commented yet.