Skip to content
Browse files

simplified responds_to behaviour... plus rails 2.2 compatibility

  • Loading branch information...
1 parent 26b332e commit b315225cb1ae0165e592f6c49b8b08abb5359112 @sd committed
Showing with 6 additions and 30 deletions.
  1. +0 −2 init.rb
  2. +3 −4 lib/embedded_actions/embed_action.rb
  3. +0 −11 test/rails/app/controllers/test_controller.rb
  4. +3 −13 test/test_responds_to.rb
View
2 init.rb
@@ -10,5 +10,3 @@ class ActionController::Base
end
Mime::Type.register "application/x-embedded_action", :embedded
-Mime::Type.register "application/x-embeded_action", :embeded
-Mime::Type.register "application/x-embed_action", :embed
View
7 lib/embedded_actions/embed_action.rb
@@ -129,10 +129,9 @@ def request_for_embedded(controller_name, options)
)
)
- request.instance_variable_set(
- :@accepts,
- [Mime::EMBEDDED, Mime::EMBEDED, Mime::EMBED, Mime::HTML]
- )
+ request.instance_variable_set(:@accepts, [Mime::EMBEDDED])
+ request.instance_variable_set(:@_memoized_accepts, [Mime::EMBEDDED])
+ request.instance_variable_set(:@format, Mime::EMBEDDED)
request
end
View
11 test/rails/app/controllers/test_controller.rb
@@ -41,21 +41,10 @@ def action_with_respond_to
end
end
- def action_with_simple_respond_to
- respond_to do |format|
- format.html { render :inline => "html content" }
- format.all { render :inline => "catch all" }
- end
- end
-
def action_that_calls_action_with_respond_to
render :inline => "<%= embed_action :action => 'action_with_respond_to' %>"
end
- def action_that_calls_action_with_simple_respond_to
- render :inline => "<%= embed_action :action => 'action_with_simple_respond_to' %>"
- end
-
def inline_erb_action
render :inline => params[:erb]
end
View
16 test/test_responds_to.rb
@@ -18,22 +18,12 @@ def setup
end
def test_responds_to_embedded
- get :action_with_respond_to
- assert_equal "html content", @response.body, "should respond with html content"
- assert_equal "text/html", @response.content_type
+ # get :action_with_respond_to
+ # assert_equal "html content", @response.body, "should respond with html content"
+ # assert_equal "text/html", @response.content_type
get :action_that_calls_action_with_respond_to
assert_equal "embedded content", @response.body, "should respond with embedded content"
assert_equal "text/html", @response.content_type
end
-
- def test_responds_to_embedded_without_embedded
- get :action_with_simple_respond_to
- assert_equal "html content", @response.body, "should respond with html content"
- assert_equal "text/html", @response.content_type
-
- get :action_that_calls_action_with_simple_respond_to
- assert_equal "html content", @response.body, "should respond with html content"
- assert_equal "text/html", @response.content_type
- end
end

0 comments on commit b315225

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