Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

made should_respond_with_content_type macro use respond_with_content_…

…type matcher
  • Loading branch information...
commit b1050a54172c1a90c9fe188a09721945608c0438 1 parent 60ecc54
Dan Croak croaky authored jferris committed
5 controller_progress.txt
... ... @@ -1,6 +1,3 @@
1   -Unfinished:
2   -should_respond_with_content_type
3   -
4 1 Finished:
5 2 should_assign_to
6 3 should_not_assign_to
@@ -10,6 +7,8 @@ should_set_the_flash_to
10 7 should_render_with_layout
11 8 should_render_without_layout
12 9 should_return_from_session
  10 +should_respond_with
  11 +should_respond_with_content_type
13 12
14 13 Won't implement:
15 14 should_be_restful
8 lib/shoulda/controller/macros.rb
@@ -187,12 +187,8 @@ def should_respond_with(response)
187 187 # should_respond_with_content_type /rss/
188 188 def should_respond_with_content_type(content_type)
189 189 should "respond with content type of #{content_type}" do
190   - content_type = Mime::EXTENSION_LOOKUP[content_type.to_s].to_s if content_type.is_a? Symbol
191   - if content_type.is_a? Regexp
192   - assert_match content_type, @response.content_type, "Expected to match #{content_type} but was actually #{@response.content_type}"
193   - else
194   - assert_equal content_type, @response.content_type, "Expected #{content_type} but was actually #{@response.content_type}"
195   - end
  190 + matcher = respond_with_content_type(content_type)
  191 + assert_accepts matcher, @controller
196 192 end
197 193 end
198 194

0 comments on commit b1050a5

Please sign in to comment.
Something went wrong with that request. Please try again.