Permalink
Browse files

Rails 2.1: fix a failing test (edge case); use ActiveSupport::Depende…

…ncies instead of just ::Dependencies
  • Loading branch information...
1 parent 5adc2de commit 94a5eac6d935a8cf3de0eb9ae0fedeaefa97e444 @mislav mislav committed Sep 12, 2008
Showing with 9 additions and 6 deletions.
  1. +2 −3 test/finder_test.rb
  2. +7 −3 test/lib/activerecord_test_connector.rb
View
@@ -396,12 +396,11 @@ def test_array_argument_doesnt_eliminate_count
def test_paginating_finder_doesnt_mangle_options
Developer.expects(:find).returns([])
- options = { :page => 1 }
- options.expects(:delete).never
+ options = { :page => 1, :per_page => 2, :foo => 'bar' }
options_before = options.dup
Developer.paginate(options)
- assert_equal options, options_before
+ assert_equal options_before, options
end
def test_paginate_by_sql_doesnt_change_original_query
@@ -16,16 +16,20 @@ def self.setup
unless self.connected || !self.able_to_connect
setup_connection
load_schema
- Dependencies.load_paths.unshift FIXTURES_PATH
+ add_load_path FIXTURES_PATH
self.connected = true
end
rescue Exception => e # errors from ActiveRecord setup
- $stderr.puts "\nSkipping ActiveRecord tests: #{e}"
- $stderr.puts "Install SQLite3 to run the full test suite for will_paginate.\n\n"
+ $stderr.puts "\nSkipping ActiveRecord tests: #{e}\n\n"
self.able_to_connect = false
end
private
+
+ def self.add_load_path(path)
+ dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies
+ dep.load_paths.unshift path
+ end
def self.setup_connection
db = ENV['DB'].blank?? 'sqlite3' : ENV['DB']

0 comments on commit 94a5eac

Please sign in to comment.