fix up code and tests to succeed
This commit is contained in:
parent
dc5e6fd970
commit
6878fc5a0e
|
@ -33,7 +33,7 @@ class Version < ActiveRecord::Base
|
|||
begin
|
||||
model.send "#{k}=", v
|
||||
rescue NoMethodError
|
||||
RAILS_DEFAULT_LOGGER.warn "Attribute #{k} does not exist on #{item_type} (Version id: #{id})."
|
||||
logger.warn "Attribute #{k} does not exist on #{item_type} (Version id: #{id})."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require File.dirname(__FILE__) + '/test_helper.rb'
|
||||
|
||||
class ApplicationController
|
||||
class ApplicationController < ActionController::Base
|
||||
def rescue_action(e)
|
||||
raise e
|
||||
end
|
||||
|
|
|
@ -213,7 +213,7 @@ class HasPaperTrailModelTest < Test::Unit::TestCase
|
|||
should 'handle datetimes' do
|
||||
# Is there a better way to test equality of two datetimes?
|
||||
format = '%a, %d %b %Y %H:%M:%S %z' # :rfc822
|
||||
assert_equal @date_time.strftime(format), @previous.a_datetime.strftime(format)
|
||||
assert_equal @date_time.utc.strftime(format), @previous.a_datetime.utc.strftime(format)
|
||||
end
|
||||
|
||||
should 'handle times' do
|
||||
|
@ -243,14 +243,14 @@ class HasPaperTrailModelTest < Test::Unit::TestCase
|
|||
|
||||
should 'restore all forward-compatible attributes' do
|
||||
format = '%a, %d %b %Y %H:%M:%S %z' # :rfc822
|
||||
assert_equal 'Warble', @last.reify.name
|
||||
assert_equal 'The quick brown fox', @last.reify.a_text
|
||||
assert_equal 42, @last.reify.an_integer
|
||||
assert_in_delta 153.01, @last.reify.a_float, 0.001
|
||||
assert_in_delta 2.71828, @last.reify.a_decimal, 0.00001
|
||||
assert_equal @date_time.strftime(format), @last.reify.a_datetime.strftime(format)
|
||||
assert_equal @time, @last.reify.a_time
|
||||
assert_equal @date, @last.reify.a_date
|
||||
assert_equal 'Warble', @last.reify.name
|
||||
assert_equal 'The quick brown fox', @last.reify.a_text
|
||||
assert_equal 42, @last.reify.an_integer
|
||||
assert_in_delta 153.01, @last.reify.a_float, 0.001
|
||||
assert_in_delta 2.71828, @last.reify.a_decimal, 0.00001
|
||||
assert_equal @date_time.utc.strftime(format), @last.reify.a_datetime.utc.strftime(format)
|
||||
assert_equal @time, @last.reify.a_time
|
||||
assert_equal @date, @last.reify.a_date
|
||||
assert @last.reify.a_boolean
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,29 +19,11 @@ end
|
|||
require 'shoulda'
|
||||
require 'paper_trail'
|
||||
|
||||
ActionController::Routing::Routes.draw do |map|
|
||||
map.connect ':controller/:action/:id'
|
||||
end
|
||||
|
||||
def connect_to_database
|
||||
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
||||
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
||||
|
||||
db_adapter = ENV['DB']
|
||||
|
||||
# no db passed, try one of these fine config-free DBs before bombing.
|
||||
db_adapter ||=
|
||||
begin
|
||||
require 'rubygems'
|
||||
require 'sqlite'
|
||||
'sqlite'
|
||||
rescue MissingSourceFile
|
||||
begin
|
||||
require 'sqlite3'
|
||||
'sqlite3'
|
||||
rescue MissingSourceFile
|
||||
end
|
||||
end
|
||||
db_adapter = ENV['DB'] || 'sqlite3'
|
||||
|
||||
if db_adapter.nil?
|
||||
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
||||
|
|
Loading…
Reference in New Issue