From f5e04ae351cdb8d5c3a7d6acf9a1374bbc563f54 Mon Sep 17 00:00:00 2001 From: Jonathan Viney Date: Wed, 3 Jun 2009 18:46:53 +1200 Subject: [PATCH] Upgrade tests for Rails 2.3 --- CHANGELOG | 8 ++++++++ test/abstract_unit.rb | 11 +++++++---- test/acts_as_taggable_test.rb | 8 ++++---- test/tag_list_test.rb | 2 +- test/tag_test.rb | 2 +- test/tagging_test.rb | 2 +- test/tags_helper_test.rb | 2 +- 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4f08a03..e94e842 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +[3 Jun 09] + +* Upgrade tests for Rails 2.3 + +[18 Mar 09] + +* Change callbacks used to save tags. + [18 Feb 09] * Greatly improve speed when using find_tagged_with and :match_all [notonthehighstreet.com]. diff --git a/test/abstract_unit.rb b/test/abstract_unit.rb index f166be4..9851622 100644 --- a/test/abstract_unit.rb +++ b/test/abstract_unit.rb @@ -14,7 +14,8 @@ fixture_path = File.dirname(__FILE__) + '/fixtures/' ActiveSupport::Dependencies.load_paths.insert(0, fixture_path) -require 'active_record/fixtures' +require "active_record/test_case" +require "active_record/fixtures" require File.dirname(__FILE__) + '/../lib/acts_as_taggable' require_dependency File.dirname(__FILE__) + '/../lib/tag_list' @@ -26,9 +27,11 @@ load(File.dirname(__FILE__) + '/schema.rb') -Test::Unit::TestCase.fixture_path = fixture_path - -class Test::Unit::TestCase #:nodoc: +class ActiveSupport::TestCase #:nodoc: + include ActiveRecord::TestFixtures + + self.fixture_path = File.dirname(__FILE__) + "/fixtures/" + self.use_transactional_fixtures = true self.use_instantiated_fixtures = false diff --git a/test/acts_as_taggable_test.rb b/test/acts_as_taggable_test.rb index acb5d12..eaaf5f9 100644 --- a/test/acts_as_taggable_test.rb +++ b/test/acts_as_taggable_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/abstract_unit' -class ActsAsTaggableOnSteroidsTest < Test::Unit::TestCase +class ActsAsTaggableOnSteroidsTest < ActiveSupport::TestCase fixtures :tags, :taggings, :posts, :users, :photos, :subscriptions, :magazines def test_find_related_tags_with @@ -204,8 +204,8 @@ def test_reassign_tag_list assert_equivalent ["Nature", "Question"], posts(:jonathan_rain).tag_list posts(:jonathan_rain).taggings.reload - # Only an update of the posts table should be executed - assert_queries 1 do + # Only an update of the posts table should be executed, the other two queries are for savepoints + assert_queries 3 do posts(:jonathan_rain).update_attributes!(:tag_list => posts(:jonathan_rain).tag_list.to_s) end @@ -375,7 +375,7 @@ def test_tag_destroyed_when_unused end end -class ActsAsTaggableOnSteroidsFormTest < Test::Unit::TestCase +class ActsAsTaggableOnSteroidsFormTest < ActiveSupport::TestCase fixtures :tags, :taggings, :posts, :users, :photos include ActionView::Helpers::FormHelper diff --git a/test/tag_list_test.rb b/test/tag_list_test.rb index bca3fe5..17d4ab9 100644 --- a/test/tag_list_test.rb +++ b/test/tag_list_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/abstract_unit' -class TagListTest < Test::Unit::TestCase +class TagListTest < ActiveSupport::TestCase def test_from_leaves_string_unchanged tags = '"One ", Two' original = tags.dup diff --git a/test/tag_test.rb b/test/tag_test.rb index 043c771..c22aa73 100644 --- a/test/tag_test.rb +++ b/test/tag_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/abstract_unit' -class TagTest < Test::Unit::TestCase +class TagTest < ActiveSupport::TestCase fixtures :tags, :taggings, :users, :photos, :posts def test_name_required diff --git a/test/tagging_test.rb b/test/tagging_test.rb index 172b8e2..f9bc091 100644 --- a/test/tagging_test.rb +++ b/test/tagging_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/abstract_unit' -class TaggingTest < Test::Unit::TestCase +class TaggingTest < ActiveSupport::TestCase fixtures :tags, :taggings, :posts def test_tag diff --git a/test/tags_helper_test.rb b/test/tags_helper_test.rb index 9c3ce53..4ed064d 100644 --- a/test/tags_helper_test.rb +++ b/test/tags_helper_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/abstract_unit' -class TagsHelperTest < Test::Unit::TestCase +class TagsHelperTest < ActiveSupport::TestCase fixtures :tags, :taggings, :posts include TagsHelper