diff --git a/test/fixtures/recurring_todos.yml b/test/fixtures/recurring_todos.yml index a6e80320..a8469ff7 100644 --- a/test/fixtures/recurring_todos.yml +++ b/test/fixtures/recurring_todos.yml @@ -22,7 +22,7 @@ end %> -1: +call_bill_gates_every_day: id: 1 user_id: 1 context_id: 1 @@ -48,7 +48,7 @@ end created_at: <%= last_week %> completed_at: ~ -2: +call_bill_gates_every_workday: id: 2 user_id: 1 context_id: 1 @@ -74,7 +74,7 @@ end created_at: <%= last_week %> completed_at: ~ -3: +call_bill_gates_every_week: id: 3 user_id: 1 context_id: 1 @@ -100,7 +100,7 @@ end created_at: <%= last_week %> completed_at: ~ -4: +check_with_bill_every_last_friday_of_month: id: 4 user_id: 1 context_id: 1 @@ -126,7 +126,7 @@ end created_at: <%= last_week %> completed_at: ~ -5: +birthday_reinier: id: 5 user_id: 1 context_id: 1 @@ -150,4 +150,4 @@ end every_count: ~ weekday: ~ created_at: <%= last_week %> - completed_at: ~ \ No newline at end of file + completed_at: ~ diff --git a/test/fixtures/todos.yml b/test/fixtures/todos.yml index 4dcf984e..3830a8f1 100644 --- a/test/fixtures/todos.yml +++ b/test/fixtures/todos.yml @@ -23,7 +23,7 @@ end %> -1: +call_bill: id: 1 context_id: 1 project_id: 2 @@ -35,7 +35,7 @@ end completed_at: ~ user_id: 1 -2: +call_dino_ext: id: 2 context_id: 2 project_id: 3 @@ -47,7 +47,7 @@ end completed_at: ~ user_id: 1 -3: +buy_milk: id: 3 context_id: 4 project_id: ~ @@ -59,7 +59,7 @@ end completed_at: <%= today %> user_id: 1 -4: +buy_bread: id: 4 context_id: 4 project_id: ~ @@ -71,7 +71,7 @@ end completed_at: <%= today %> user_id: 1 -5: +construct_dilation_device: id: 5 context_id: 5 project_id: 1 @@ -83,7 +83,7 @@ end completed_at: ~ user_id: 1 -6: +phone_grandfather: id: 6 context_id: 2 project_id: 1 @@ -107,7 +107,7 @@ book: completed_at: ~ user_id: 1 -8: +upgrade_rails: id: 8 context_id: 4 project_id: ~ @@ -119,7 +119,7 @@ book: completed_at: <%= today %> user_id: 1 -9: +due_today: id: 9 context_id: 1 project_id: ~ @@ -131,7 +131,7 @@ book: completed_at: ~ user_id: 1 -10: +foo: id: 10 context_id: 1 project_id: ~ @@ -143,7 +143,7 @@ book: completed_at: <%= last_week %> user_id: 1 -11: +buy_shares: id: 11 context_id: 1 project_id: 2 @@ -155,7 +155,7 @@ book: completed_at: ~ user_id: 1 -12: +buy_stego_bait: id: 12 context_id: 1 project_id: 3 @@ -167,7 +167,7 @@ book: completed_at: ~ user_id: 1 -13: +new_action_in_context: id: 13 context_id: 1 project_id: 3 @@ -179,7 +179,7 @@ book: completed_at: ~ user_id: 1 -14: +call_stock_broker: id: 14 context_id: 2 project_id: 2 @@ -191,7 +191,7 @@ book: completed_at: ~ user_id: 1 -15: +select_delorean_model: id: 15 context_id: 6 project_id: 1 @@ -204,7 +204,7 @@ book: show_from: <%= next_week %> user_id: 1 -16: +buy_tix: id: 16 context_id: 10 project_id: 4 @@ -218,7 +218,7 @@ book: user_id: 2 -17: +pal_confirmation: id: 17 context_id: 11 project_id: 4 @@ -231,7 +231,7 @@ book: show_from: <%= next_week %> user_id: 2 -18: +call_bill_gates_every_day: id: 18 user_id: 1 context_id: 1 @@ -243,4 +243,4 @@ book: due: <%= last_week %> completed_at: ~ show_from: ~ - recurring_todo_id: 1 \ No newline at end of file + recurring_todo_id: 1 diff --git a/test/functional/backend_controller_test.rb b/test/functional/backend_controller_test.rb index 7f53f31e..517743d3 100644 --- a/test/functional/backend_controller_test.rb +++ b/test/functional/backend_controller_test.rb @@ -4,7 +4,7 @@ require 'backend_controller' # Re-raise errors caught by the controller. class BackendController; def rescue_action(e) raise e end; end -class BackendControllerTest < Test::Rails::TestCase +class BackendControllerTest < ActionController::TestCase fixtures :users, :projects, :contexts, :todos, :recurring_todos, :notes def setup diff --git a/test/functional/contexts_controller_test.rb b/test/functional/contexts_controller_test.rb index 2e2c5cfc..7c5f058b 100644 --- a/test/functional/contexts_controller_test.rb +++ b/test/functional/contexts_controller_test.rb @@ -186,4 +186,4 @@ class ContextsControllerTest < TodoContainerControllerTestBase def protect_against_forgery? false end -end \ No newline at end of file +end diff --git a/test/functional/data_controller_test.rb b/test/functional/data_controller_test.rb index 4084ac59..57b466e7 100644 --- a/test/functional/data_controller_test.rb +++ b/test/functional/data_controller_test.rb @@ -4,7 +4,7 @@ require 'data_controller' # Re-raise errors caught by the controller. class DataController; def rescue_action(e) raise e end; end -class DataControllerTest < Test::Rails::TestCase +class DataControllerTest < ActionController::TestCase fixtures :users, :preferences, :projects, :notes def setup diff --git a/test/functional/feedlist_controller_test.rb b/test/functional/feedlist_controller_test.rb index a1f6fff6..aa1d4326 100644 --- a/test/functional/feedlist_controller_test.rb +++ b/test/functional/feedlist_controller_test.rb @@ -4,7 +4,7 @@ require 'feedlist_controller' # Re-raise errors caught by the controller. class FeedlistController; def rescue_action(e) raise e end; end -class FeedlistControllerTest < Test::Rails::TestCase +class FeedlistControllerTest < ActionController::TestCase fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos, :notes def setup diff --git a/test/functional/integrations_controller_test.rb b/test/functional/integrations_controller_test.rb index bf9a1c50..fad4bbef 100644 --- a/test/functional/integrations_controller_test.rb +++ b/test/functional/integrations_controller_test.rb @@ -4,7 +4,7 @@ require 'integrations_controller' # Re-raise errors caught by the controller. class IntegrationsController; def rescue_action(e) raise e end; end -class IntegrationsControllerTest < Test::Unit::TestCase +class IntegrationsControllerTest < ActionController::TestCase fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos, :tags, :taggings def setup diff --git a/test/functional/login_controller_test.rb b/test/functional/login_controller_test.rb index b585dd6b..8896d5cb 100644 --- a/test/functional/login_controller_test.rb +++ b/test/functional/login_controller_test.rb @@ -5,7 +5,7 @@ require_dependency "login_system" # Re-raise errors caught by the controller. class LoginController; def rescue_action(e) raise e end; end -class LoginControllerTest < Test::Rails::TestCase +class LoginControllerTest < ActionController::TestCase fixtures :preferences, :users def setup diff --git a/test/functional/notes_controller_test.rb b/test/functional/notes_controller_test.rb index 4804d4e3..15510555 100644 --- a/test/functional/notes_controller_test.rb +++ b/test/functional/notes_controller_test.rb @@ -4,7 +4,7 @@ require 'notes_controller' # Re-raise errors caught by the controller. class NotesController; def rescue_action(e) raise e end; end -class NotesControllerTest < Test::Rails::TestCase +class NotesControllerTest < ActionController::TestCase def setup @controller = NotesController.new request = ActionController::TestRequest.new diff --git a/test/functional/preferences_controller_test.rb b/test/functional/preferences_controller_test.rb index 52ee37c2..e7a6cc2a 100644 --- a/test/functional/preferences_controller_test.rb +++ b/test/functional/preferences_controller_test.rb @@ -5,7 +5,7 @@ require 'preference' # Re-raise errors caught by the controller. class PreferencesController; def rescue_action(e) raise e end; end -class PreferencesControllerTest < Test::Rails::TestCase +class PreferencesControllerTest < ActionController::TestCase fixtures :users, :preferences def setup diff --git a/test/functional/stats_controller_test.rb b/test/functional/stats_controller_test.rb index 62c661c9..0de6a63e 100755 --- a/test/functional/stats_controller_test.rb +++ b/test/functional/stats_controller_test.rb @@ -4,7 +4,7 @@ require 'stats_controller' # Re-raise errors caught by the controller. class StatsController; def rescue_action(e) raise e end; end -class StatsControllerTest < Test::Unit::TestCase +class StatsControllerTest < ActionController::TestCase fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos, :recurring_todos, :tags, :taggings def setup @@ -59,7 +59,7 @@ class StatsControllerTest < Test::Unit::TestCase assert_equal 16, assigns['actions'].count assert_equal 4, assigns['tags_count'] assert_equal 2, assigns['unique_tags_count'] - assert_equal 2.week.ago.utc.beginning_of_day, assigns['first_action'].created_at + assert_equal 2.week.ago.beginning_of_day, assigns['first_action'].created_at end def test_downdrill diff --git a/test/functional/todo_container_controller_test_base.rb b/test/functional/todo_container_controller_test_base.rb index 9742f173..dfb8bd0a 100644 --- a/test/functional/todo_container_controller_test_base.rb +++ b/test/functional/todo_container_controller_test_base.rb @@ -1,5 +1,10 @@ -class TodoContainerControllerTestBase < Test::Rails::TestCase +class TodoContainerControllerTestBase < ActionController::TestCase + def setup_controller_request_and_response + # override with empty + # TODO: remove these ugly hacks + end + def perform_setup(container_class, controller_class) @controller = controller_class.new @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new diff --git a/test/functional/todos_controller_test.rb b/test/functional/todos_controller_test.rb index d6d2fa0c..65cb9994 100644 --- a/test/functional/todos_controller_test.rb +++ b/test/functional/todos_controller_test.rb @@ -4,7 +4,7 @@ require 'todos_controller' # Re-raise errors caught by the controller. class TodosController; def rescue_action(e) raise e end; end -class TodosControllerTest < Test::Rails::TestCase +class TodosControllerTest < ActionController::TestCase fixtures :users, :preferences, :projects, :contexts, :todos, :tags, :taggings, :recurring_todos def setup @@ -358,7 +358,7 @@ class TodosControllerTest < Test::Rails::TestCase "show_from(1i)"=>"", "show_from(2i)"=>"", "show_from(3i)"=>"", "project_id"=>"1", "notes"=>"test notes", "description"=>"test_mobile_create_action", "state"=>"0"}} - assert_redirected_to '/m' + assert_redirected_to '/mobile' end def test_mobile_create_action_renders_new_template_when_save_fails diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index daad85d9..316ca02b 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -4,7 +4,7 @@ require 'users_controller' # Re-raise errors caught by the controller. class UsersController; def rescue_action(e) raise e end; end -class UsersControllerTest < Test::Rails::TestCase +class UsersControllerTest < ActionController::TestCase fixtures :preferences, :users def setup @@ -51,10 +51,10 @@ class UsersControllerTest < Test::Rails::TestCase def test_destroy_user login_as :admin_user - @no_users_before = User.find(:all).size - xhr :post, :destroy, :id => users(:ldap_user).to_param + nr_users_before = User.find(:all).size + xhr :post, :destroy, :id => users(:ldap_user).id.to_param assert_rjs :page, "user-3", :remove - assert_equal @no_users_before-1, User.find(:all).size + assert_equal nr_users_before-1, User.find(:all).size end def test_update_password_successful diff --git a/test/integration/users_xml_api_test.rb b/test/integration/users_xml_api_test.rb index 43a8521e..f80f6b25 100644 --- a/test/integration/users_xml_api_test.rb +++ b/test/integration/users_xml_api_test.rb @@ -84,7 +84,7 @@ class UsersXmlApiTest < ActionController::IntegrationTest end def test_get_user_as_xml - get "/users/#{users(:other_user).login}.xml", {}, basic_auth_headers() + get "/users/#{users(:other_user).id}.xml", {}, basic_auth_headers() assert_response :success assert_tag :tag => "user" assert_no_tag :tag => "password" @@ -104,4 +104,4 @@ class UsersXmlApiTest < ActionController::IntegrationTest assert_response_and_body 404, "Expected post format is valid xml like so: usernameabc123." end -end \ No newline at end of file +end diff --git a/test/test_helper.rb b/test/test_helper.rb index c34d707f..9c3679e4 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,7 @@ ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require File.expand_path(File.dirname(__FILE__) + "/../app/controllers/application") -require 'test/rails' #you need the zentest gem installed +require 'autotest/rails' #you need the zentest gem installed require 'test_help' require 'flexmock/test_unit' #and the flexmock gem, too! require 'action_web_service/test_invoke' @@ -41,21 +41,8 @@ class Test::Unit::TestCase end -class Test::Rails::HelperTestCase - self.use_transactional_fixtures = false - self.use_instantiated_fixtures = false - -end - -class Test::Rails::TestCase < Test::Unit::TestCase - - # Turn off transactional fixtures if you're working with MyISAM tables in MySQL - self.use_transactional_fixtures = true - - # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david) - self.use_instantiated_fixtures = false - +class ActiveSupport::TestCase # Generates a random string of ascii characters (a-z, "1 0") # of a given length for testing assignment to fields # for validation purposes @@ -144,4 +131,4 @@ class ActionController::IntegrationTest assert_response_and_body 401, "401 Unauthorized: Only admin users are allowed access to this function." end -end \ No newline at end of file +end diff --git a/test/unit/context_test.rb b/test/unit/context_test.rb index f0514698..bf310489 100644 --- a/test/unit/context_test.rb +++ b/test/unit/context_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class ContextTest < Test::Rails::TestCase +class ContextTest < ActiveSupport::TestCase fixtures :contexts, :todos, :recurring_todos, :users, :preferences def setup diff --git a/test/unit/message_gateway_test.rb b/test/unit/message_gateway_test.rb index 32f77159..ffb8c5c3 100644 --- a/test/unit/message_gateway_test.rb +++ b/test/unit/message_gateway_test.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/../test_helper' -class MessageGatewayTest < Test::Rails::TestCase - fixtures :users, :contexts +class MessageGatewayTest < ActiveSupport::TestCase + fixtures :users, :contexts, :todos def setup @user = users(:sms_user) diff --git a/test/unit/notes_test.rb b/test/unit/notes_test.rb index c9691c62..7f9a83e4 100644 --- a/test/unit/notes_test.rb +++ b/test/unit/notes_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class NotesTest < Test::Rails::TestCase +class NotesTest < ActiveSupport::TestCase fixtures :notes def setup diff --git a/test/unit/preference_test.rb b/test/unit/preference_test.rb index 18595ef7..1ced0f83 100644 --- a/test/unit/preference_test.rb +++ b/test/unit/preference_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class PreferenceTest < Test::Rails::TestCase +class PreferenceTest < ActiveSupport::TestCase fixtures :users, :preferences def setup diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index b654a96d..edeb1703 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class ProjectTest < Test::Rails::TestCase +class ProjectTest < ActiveSupport::TestCase fixtures :projects, :contexts, :todos, :recurring_todos, :users, :preferences def setup diff --git a/test/unit/prototype_helper_extensions_test.rb b/test/unit/prototype_helper_extensions_test.rb index 19932341..c2046a37 100644 --- a/test/unit/prototype_helper_extensions_test.rb +++ b/test/unit/prototype_helper_extensions_test.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../../lib/prototype_helper_extensions' -class PrototypeHelperExtensionsTest < Test::Unit::TestCase +class PrototypeHelperExtensionsTest < ActiveSupport::TestCase include ActionView::Helpers::JavaScriptHelper include ActionView::Helpers::PrototypeHelper include ActionView::Helpers::ScriptaculousHelper diff --git a/test/unit/recurring_todo_test.rb b/test/unit/recurring_todo_test.rb index 9498216b..8648d22a 100644 --- a/test/unit/recurring_todo_test.rb +++ b/test/unit/recurring_todo_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class RecurringTodoTest < Test::Rails::TestCase +class RecurringTodoTest < ActiveSupport::TestCase fixtures :todos, :users, :contexts, :preferences, :tags, :taggings, :recurring_todos def setup diff --git a/test/unit/tag_test.rb b/test/unit/tag_test.rb index c0aac834..36f42018 100644 --- a/test/unit/tag_test.rb +++ b/test/unit/tag_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class TagTest < Test::Rails::TestCase +class TagTest < ActiveSupport::TestCase fixtures :tags # Replace this with your real tests. diff --git a/test/unit/tagging_test.rb b/test/unit/tagging_test.rb index e33fd40b..6c57c944 100644 --- a/test/unit/tagging_test.rb +++ b/test/unit/tagging_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class TaggingTest < Test::Rails::TestCase +class TaggingTest < ActiveSupport::TestCase fixtures :taggings # Replace this with your real tests. diff --git a/test/unit/todo_create_params_helper_test.rb b/test/unit/todo_create_params_helper_test.rb index ade5cbfd..875c0e26 100644 --- a/test/unit/todo_create_params_helper_test.rb +++ b/test/unit/todo_create_params_helper_test.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/../test_helper' require 'todos_controller' -class TodoCreateParamsHelperTest < Test::Rails::TestCase +class TodoCreateParamsHelperTest < ActiveSupport::TestCase def test_works_with_request_as_root_hash_entry params = {'request' => { 'todo' => { 'description' => 'foo'}}} @@ -133,4 +133,4 @@ class TodoCreateParamsHelperTest < Test::Rails::TestCase assert_equal false, params_helper.context_specified_by_name? end -end \ No newline at end of file +end diff --git a/test/unit/todo_test.rb b/test/unit/todo_test.rb index 8b41f769..26347c7a 100644 --- a/test/unit/todo_test.rb +++ b/test/unit/todo_test.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/../test_helper' require 'date' -class TodoTest < Test::Rails::TestCase +class TodoTest < ActiveSupport::TestCase fixtures :todos, :recurring_todos, :users, :contexts, :preferences, :tags, :taggings def setup diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 403750eb..b3c62fbc 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -16,7 +16,7 @@ class SimpleLdapAuthenticator end end -class UserTest < Test::Rails::TestCase +class UserTest < ActiveSupport::TestCase fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos def setup