Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

made should_respond_with_content_type macro use respond_with_content_…

…type matcher
  • Loading branch information...
commit b1050a54172c1a90c9fe188a09721945608c0438 1 parent 60ecc54
@croaky croaky authored jferris committed
Showing with 4 additions and 9 deletions.
  1. +2 −3 controller_progress.txt
  2. +2 −6 lib/shoulda/controller/macros.rb
View
5 controller_progress.txt
@@ -1,6 +1,3 @@
-Unfinished:
-should_respond_with_content_type
-
Finished:
should_assign_to
should_not_assign_to
@@ -10,6 +7,8 @@ should_set_the_flash_to
should_render_with_layout
should_render_without_layout
should_return_from_session
+should_respond_with
+should_respond_with_content_type
Won't implement:
should_be_restful
View
8 lib/shoulda/controller/macros.rb
@@ -187,12 +187,8 @@ def should_respond_with(response)
# should_respond_with_content_type /rss/
def should_respond_with_content_type(content_type)
should "respond with content type of #{content_type}" do
- content_type = Mime::EXTENSION_LOOKUP[content_type.to_s].to_s if content_type.is_a? Symbol
- if content_type.is_a? Regexp
- assert_match content_type, @response.content_type, "Expected to match #{content_type} but was actually #{@response.content_type}"
- else
- assert_equal content_type, @response.content_type, "Expected #{content_type} but was actually #{@response.content_type}"
- end
+ matcher = respond_with_content_type(content_type)
+ assert_accepts matcher, @controller
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.