From fe52c0ab3c07061c62326081bd8284d3241207f0 Mon Sep 17 00:00:00 2001 From: Eric Allen Date: Tue, 13 Oct 2009 23:38:25 -0400 Subject: [PATCH] Fixed some failing tests and removed dead ones. --- test/functional/contexts_controller_test.rb | 10 +-- test/functional/projects_controller_test.rb | 9 --- test/functional/todos_controller_test.rb | 6 -- test/unit/prototype_helper_extensions_test.rb | 73 ------------------- 4 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 test/unit/prototype_helper_extensions_test.rb diff --git a/test/functional/contexts_controller_test.rb b/test/functional/contexts_controller_test.rb index 2e2c5cfc..fa4cd36f 100644 --- a/test/functional/contexts_controller_test.rb +++ b/test/functional/contexts_controller_test.rb @@ -21,14 +21,6 @@ class ContextsControllerTest < TodoContainerControllerTestBase assert_ajax_create_increments_count '@newcontext' end - def test_create_context_with_ajax_success_rjs - ajax_create '@newcontext' - assert_rjs :insert_html, :bottom, "list-contexts" - assert_rjs :sortable, 'list-contexts', { :tag => 'div', :handle => 'handle', :complete => visual_effect(:highlight, 'list-contexts'), :url => order_contexts_path } - # not yet sure how to write the following properly... - assert_rjs :call, "Form.reset", "context-form" - assert_rjs :call, "Form.focusFirstElement", "context-form" - end def test_create_via_ajax_with_comma_in_name_does_not_increment_number_of_contexts assert_ajax_create_does_not_increment_count 'foo,bar' @@ -186,4 +178,4 @@ class ContextsControllerTest < TodoContainerControllerTestBase def protect_against_forgery? false end -end \ No newline at end of file +end diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 78b12270..b1cf6154 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -48,15 +48,6 @@ class ProjectsControllerTest < TodoContainerControllerTestBase assert_ajax_create_increments_count 'My New Project' end - def test_create_project_with_ajax_success_rjs - ajax_create 'My New Project' - assert_rjs :insert_html, :bottom, "list-active-projects" - assert_rjs :sortable, 'list-active-projects', { :tag => 'div', :handle => 'handle', :complete => visual_effect(:highlight, 'list-active-projects'), :url => order_projects_path } - # not yet sure how to write the following properly... - assert_rjs :call, "Form.reset", "project-form" - assert_rjs :call, "Form.focusFirstElement", "project-form" - end - def test_create_project_and_go_to_project_page num_projects = Project.count xhr :post, :create, { :project => {:name => 'Immediate Project Planning Required'}, :go_to_project => 1} diff --git a/test/functional/todos_controller_test.rb b/test/functional/todos_controller_test.rb index f14eac69..864a295b 100644 --- a/test/functional/todos_controller_test.rb +++ b/test/functional/todos_controller_test.rb @@ -371,12 +371,6 @@ class TodosControllerTest < ActionController::TestCase assert_template 'todos/new' end - def test_index_html_assigns_default_project_name_map - login_as(:admin_user) - get :index, {"format"=>"html"} - assert_equal '"{\\"Build a working time machine\\": \\"lab\\"}"', assigns(:default_project_context_name_map) - end - def test_toggle_check_on_recurring_todo login_as(:admin_user) diff --git a/test/unit/prototype_helper_extensions_test.rb b/test/unit/prototype_helper_extensions_test.rb deleted file mode 100644 index 19932341..00000000 --- a/test/unit/prototype_helper_extensions_test.rb +++ /dev/null @@ -1,73 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require File.dirname(__FILE__) + '/../../lib/prototype_helper_extensions' - -class PrototypeHelperExtensionsTest < Test::Unit::TestCase - include ActionView::Helpers::JavaScriptHelper - include ActionView::Helpers::PrototypeHelper - include ActionView::Helpers::ScriptaculousHelper - - include ActionView::Helpers::UrlHelper - include ActionView::Helpers::TagHelper - include ActionView::Helpers::TextHelper - include ActionView::Helpers::FormTagHelper - include ActionView::Helpers::FormHelper - include ActionView::Helpers::CaptureHelper - - def setup - @template = nil - @controller = Class.new do - def url_for(options, *parameters_for_method_reference) - if options.is_a?(String) - options - elsif options.is_a?(Hash) - url = "http://www.example.com/" - url << options[:action].to_s if options and options[:action] - url << "?a=#{options[:a]}" if options && options[:a] - url << "&b=#{options[:b]}" if options && options[:a] && options[:b] - url - elsif options.is_a?(JavaScriptRef) - url = options.to_json - else - raise 'unhandled type' + options.class.inspect - end - end - - end.new - @generator = create_generator - end - - def test_confirming - @generator.confirming("Please confirm.") do - @generator.alert 'foo' - end - assert_equal "if (confirm('Please confirm.')) {\nalert(\"foo\");\n}", @generator.to_s - end - - def test_confirming_with_javascript - @generator.confirming("'Please confirm ' + this.title + '.'") do - @generator.alert 'foo' - end - assert_equal "if (confirm('Please confirm ' + this.title + '.')) {\nalert(\"foo\");\n}", @generator.to_s - end - - def test_remote_to_href - assert_equal "new Ajax.Request(this.href, {asynchronous:true, evalScripts:true})\n", remote_to_href - end - - def test_remote_to_href_with_options - assert_equal "new Ajax.Request(this.href, {asynchronous:true, evalScripts:true, method:'put'})\n", remote_to_href(:method => 'put') - end - - protected - def create_generator - block = Proc.new { |*args| yield *args if block_given? } - JavaScriptGenerator.new self, &block - end - - def protect_against_forgery? - false - end - - attr_accessor :output_buffer -end -