Skip to content

Commit

Permalink
Rails 2.1: fix a failing test (edge case); use ActiveSupport::Depende…
Browse files Browse the repository at this point in the history
…ncies instead of just ::Dependencies
  • Loading branch information
mislav committed Sep 12, 2008
1 parent 5adc2de commit 94a5eac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 2 additions & 3 deletions test/finder_test.rb
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions test/lib/activerecord_test_connector.rb
Expand Up @@ -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']
Expand Down

0 comments on commit 94a5eac

Please sign in to comment.