diff options
Diffstat (limited to 'actionpack/test')
7 files changed, 31 insertions, 15 deletions
diff --git a/actionpack/test/controller/http_token_authentication_test.rb b/actionpack/test/controller/http_token_authentication_test.rb index 3054c1684c..ad4e743be8 100644 --- a/actionpack/test/controller/http_token_authentication_test.rb +++ b/actionpack/test/controller/http_token_authentication_test.rb @@ -79,6 +79,14 @@ class HttpTokenAuthenticationTest < ActionController::TestCase end end + test "authentication request with badly formatted header" do + @request.env['HTTP_AUTHORIZATION'] = "Token foobar" + get :index + + assert_response :unauthorized + assert_equal "HTTP Token: Access denied.\n", @response.body, "Authentication header was not properly parsed" + end + test "authentication request without credential" do get :display diff --git a/actionpack/test/controller/new_base/render_action_test.rb b/actionpack/test/controller/new_base/render_action_test.rb index aa44e0b282..475bf9d3c9 100644 --- a/actionpack/test/controller/new_base/render_action_test.rb +++ b/actionpack/test/controller/new_base/render_action_test.rb @@ -86,8 +86,6 @@ module RenderAction def setup end - describe "Both <controller_path>.html.erb and application.html.erb are missing" - test "rendering with layout => true" do assert_raise(ArgumentError) do get "/render_action/basic/hello_world_with_layout", {}, "action_dispatch.show_exceptions" => false @@ -154,8 +152,6 @@ module RenderActionWithApplicationLayout end class LayoutTest < Rack::TestCase - describe "Only application.html.erb is present and <controller_path>.html.erb is missing" - test "rendering implicit application.html.erb as layout" do get "/render_action_with_application_layout/basic/hello_world" @@ -232,8 +228,6 @@ module RenderActionWithControllerLayout end class ControllerLayoutTest < Rack::TestCase - describe "Only <controller_path>.html.erb is present and application.html.erb is missing" - test "render hello_world and implicitly use <controller_path>.html.erb as a layout." do get "/render_action_with_controller_layout/basic/hello_world" @@ -290,8 +284,6 @@ module RenderActionWithBothLayouts end class ControllerLayoutTest < Rack::TestCase - describe "Both <controller_path>.html.erb and application.html.erb are present" - test "rendering implicitly use <controller_path>.html.erb over application.html.erb as a layout" do get "/render_action_with_both_layouts/basic/hello_world" diff --git a/actionpack/test/controller/new_base/render_template_test.rb b/actionpack/test/controller/new_base/render_template_test.rb index 00c7df2af8..156d87c321 100644 --- a/actionpack/test/controller/new_base/render_template_test.rb +++ b/actionpack/test/controller/new_base/render_template_test.rb @@ -160,8 +160,6 @@ module RenderTemplate end class TestWithLayout < Rack::TestCase - describe "Rendering with :template using implicit or explicit layout" - test "rendering with implicit layout" do with_routing do |set| set.draw { get ':controller', :action => :index } diff --git a/actionpack/test/controller/new_base/render_text_test.rb b/actionpack/test/controller/new_base/render_text_test.rb index f8d02e8b6c..d6c3926a4d 100644 --- a/actionpack/test/controller/new_base/render_text_test.rb +++ b/actionpack/test/controller/new_base/render_text_test.rb @@ -63,8 +63,6 @@ module RenderText end class RenderTextTest < Rack::TestCase - describe "Rendering text using render :text" - test "rendering text from an action with default options renders the text with the layout" do with_routing do |set| set.draw { get ':controller', :action => 'index' } diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index 8070bdec8a..58457b0c28 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -98,6 +98,15 @@ module ActionDispatch mapper.get '/*path', :to => 'pages#show', :format => true assert_equal '/*path.:format', fakeset.conditions.first[:path_info] end + + def test_raising_helpful_error_on_invalid_arguments + fakeset = FakeSet.new + mapper = Mapper.new fakeset + app = lambda { |env| [200, {}, [""]] } + assert_raises ArgumentError do + mapper.mount app + end + end end end end diff --git a/actionpack/test/template/active_model_helper_test.rb b/actionpack/test/template/active_model_helper_test.rb index 24511df444..86bccdfade 100644 --- a/actionpack/test/template/active_model_helper_test.rb +++ b/actionpack/test/template/active_model_helper_test.rb @@ -41,6 +41,19 @@ class ActiveModelHelperTest < ActionView::TestCase ) end + def test_select_with_errors + assert_dom_equal( + %(<div class="field_with_errors"><select name="post[author_name]" id="post_author_name"><option value="a">a</option>\n<option value="b">b</option></select></div>), + select("post", "author_name", [:a, :b]) + ) + end + + def test_select_with_errors_and_blank_option + expected_dom = %(<div class="field_with_errors"><select name="post[author_name]" id="post_author_name"><option value="">Choose one...</option>\n<option value="a">a</option>\n<option value="b">b</option></select></div>) + assert_dom_equal(expected_dom, select("post", "author_name", [:a, :b], :include_blank => 'Choose one...')) + assert_dom_equal(expected_dom, select("post", "author_name", [:a, :b], :prompt => 'Choose one...')) + end + def test_date_select_with_errors assert_dom_equal( %(<div class="field_with_errors"><select id="post_updated_at_1i" name="post[updated_at(1i)]">\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n</select>\n<input id="post_updated_at_2i" name="post[updated_at(2i)]" type="hidden" value="6" />\n<input id="post_updated_at_3i" name="post[updated_at(3i)]" type="hidden" value="1" />\n</div>), @@ -82,4 +95,5 @@ class ActiveModelHelperTest < ActionView::TestCase ensure ActionView::Base.field_error_proc = old_proc if old_proc end + end diff --git a/actionpack/test/template/erb/tag_helper_test.rb b/actionpack/test/template/erb/tag_helper_test.rb index 1724d6432d..84e328d8be 100644 --- a/actionpack/test/template/erb/tag_helper_test.rb +++ b/actionpack/test/template/erb/tag_helper_test.rb @@ -3,9 +3,6 @@ require "template/erb/helper" module ERBTest class TagHelperTest < BlockTestCase - - extend ActiveSupport::Testing::Declarative - test "percent equals works for content_tag and does not require parenthesis on method call" do assert_equal "<div>Hello world</div>", render_content("content_tag :div", "Hello world") end |