From 14cf4b2e353f923155aab1ae0eaafed3c2924b12 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 23 Aug 2011 11:07:37 +0100 Subject: Don't modify params in place - fixes #2624 --- actionpack/test/controller/test_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/test/controller/test_test.rb') diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 043d44500a..eae5a3d472 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -515,6 +515,12 @@ XML ) end + def test_params_passing_doesnt_modify_in_place + page = {:name => "Page name", :month => 4, :year => 2004, :day => 6} + get :test_params, :page => page + assert_equal 2004, page[:year] + end + def test_id_converted_to_string get :test_params, :id => 20, :foo => Object.new assert_kind_of String, @request.path_parameters['id'] -- cgit v1.2.3 From ebea387e4bb9f44d8c678ed9bad2ab2091d1f9c6 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 23 Aug 2011 15:33:59 +0100 Subject: Add failing test case for #2654 --- actionpack/test/controller/test_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'actionpack/test/controller/test_test.rb') diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index eae5a3d472..cba3aded2f 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -50,6 +50,10 @@ class TestTest < ActionController::TestCase render :text => request.query_string end + def test_protocol + render :text => request.protocol + end + def test_html_output render :text => < @@ -598,6 +602,19 @@ XML assert_nil @request.symbolized_path_parameters[:id] end + def test_request_protocol_is_reset_after_request + get :test_protocol + assert_equal "http://", @response.body + + @request.env["HTTPS"] = "on" + get :test_protocol + assert_equal "https://", @response.body + + @request.env.delete("HTTPS") + get :test_protocol + assert_equal "http://", @response.body + end + def test_should_have_knowledge_of_client_side_cookie_state_even_if_they_are_not_set cookies['foo'] = 'bar' get :no_op -- cgit v1.2.3 From 6e8fe1bf021139a2fbd06a10778ad2c6b67930ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 2 Oct 2011 11:28:48 +0200 Subject: TestCase should respect the view_assigns API instead of pulling variables on its own. --- actionpack/test/controller/test_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'actionpack/test/controller/test_test.rb') diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index cba3aded2f..ca87cda2a3 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -146,6 +146,17 @@ XML end end + class ViewAssignsController < ActionController::Base + def test_assigns + @foo = "foo" + render :nothing => true + end + + def view_assigns + { "bar" => "bar" } + end + end + def test_raw_post_handling params = ActiveSupport::OrderedHash[:page, {:name => 'page name'}, 'some key', 123] post :render_raw_post, params.dup @@ -256,6 +267,15 @@ XML assert_equal "foo", assigns["foo"] end + def test_view_assigns + @controller = ViewAssignsController.new + process :test_assigns + assert_equal nil, assigns(:foo) + assert_equal nil, assigns[:foo] + assert_equal "bar", assigns(:bar) + assert_equal "bar", assigns[:bar] + end + def test_assert_tag_tag process :test_html_output -- cgit v1.2.3 From 8e946daf6957b46744a90d25266b0ec5e8537079 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Mon, 3 Oct 2011 10:19:15 +0400 Subject: normalize arg for AC::TestCase tests class method --- actionpack/test/controller/test_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'actionpack/test/controller/test_test.rb') diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index ca87cda2a3..b64e275363 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -774,6 +774,22 @@ class CrazyNameTest < ActionController::TestCase end end +class CrazySymbolNameTest < ActionController::TestCase + tests :content + + def test_set_controller_class_using_symbol + assert_equal ContentController, self.class.controller_class + end +end + +class CrazyStringNameTest < ActionController::TestCase + tests 'content' + + def test_set_controller_class_using_string + assert_equal ContentController, self.class.controller_class + end +end + class NamedRoutesControllerTest < ActionController::TestCase tests ContentController -- cgit v1.2.3