diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-05-29 16:06:21 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-05-29 16:06:21 -0500 |
commit | 69742ca8fa05509f7d7c5512cb6d8e002ecb3ab3 (patch) | |
tree | 044c2131cc87d21ee54027511aae2b7f2d2ae26a /actionpack/test/controller/render_js_test.rb | |
parent | 5f3f100ce2d689480da85abc88e5e940cf90189e (diff) | |
parent | 5ec2c7dc29b36d85b2658465b8a979deb0529d7e (diff) | |
download | rails-69742ca8fa05509f7d7c5512cb6d8e002ecb3ab3.tar.gz rails-69742ca8fa05509f7d7c5512cb6d8e002ecb3ab3.tar.bz2 rails-69742ca8fa05509f7d7c5512cb6d8e002ecb3ab3.zip |
Merge branch 'master' into active_model
Conflicts:
activemodel/lib/active_model/core.rb
activemodel/test/cases/state_machine/event_test.rb
activemodel/test/cases/state_machine/state_transition_test.rb
activerecord/lib/active_record/validations.rb
activerecord/test/cases/validations/i18n_validation_test.rb
activeresource/lib/active_resource.rb
activeresource/test/abstract_unit.rb
Diffstat (limited to 'actionpack/test/controller/render_js_test.rb')
-rw-r--r-- | actionpack/test/controller/render_js_test.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_js_test.rb b/actionpack/test/controller/render_js_test.rb new file mode 100644 index 0000000000..d02fd3fd4c --- /dev/null +++ b/actionpack/test/controller/render_js_test.rb @@ -0,0 +1,39 @@ +require 'abstract_unit' +require 'controller/fake_models' +require 'pathname' + +class TestController < ActionController::Base + protect_from_forgery + + def render_vanilla_js_hello + render :js => "alert('hello')" + end + + def greeting + # let's just rely on the template + end + + def partial + render :partial => 'partial' + end +end + +class RenderTest < ActionController::TestCase + tests TestController + + def test_render_vanilla_js + get :render_vanilla_js_hello + assert_equal "alert('hello')", @response.body + assert_equal "text/javascript", @response.content_type + end + + def test_render_with_default_from_accept_header + xhr :get, :greeting + assert_equal "$(\"body\").visualEffect(\"highlight\");", @response.body + end + + def test_should_render_js_partial + xhr :get, :partial, :format => 'js' + assert_equal 'partial js', @response.body + end +end
\ No newline at end of file |