summaryrefslogtreecommitdiff
path: root/vendor/plugins/globalize2/test/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/plugins/globalize2/test/test_helper.rb')
-rw-r--r--vendor/plugins/globalize2/test/test_helper.rb76
1 files changed, 0 insertions, 76 deletions
diff --git a/vendor/plugins/globalize2/test/test_helper.rb b/vendor/plugins/globalize2/test/test_helper.rb
deleted file mode 100644
index 195907d..0000000
--- a/vendor/plugins/globalize2/test/test_helper.rb
+++ /dev/null
@@ -1,76 +0,0 @@
1$LOAD_PATH << File.expand_path( File.dirname(__FILE__) + '/../lib' )
2
3require 'rubygems'
4require 'test/unit'
5require 'active_record'
6require 'active_support'
7require 'active_support/test_case'
8require 'mocha'
9require 'globalize'
10require 'validation_reflection'
11
12config = { :adapter => 'sqlite3', :database => ':memory:' }
13ActiveRecord::Base.establish_connection(config)
14
15class ActiveSupport::TestCase
16 def reset_db!(schema_path = nil)
17 schema_path ||= File.expand_path(File.dirname(__FILE__) + '/data/schema.rb')
18 ActiveRecord::Migration.verbose = false
19 ActiveRecord::Base.silence { load(schema_path) }
20 end
21
22 def assert_member(item, array)
23 assert_block "Item #{item} is not in array #{array}" do
24 array.member?(item)
25 end
26 end
27
28 def assert_belongs_to(model, associated)
29 assert model.reflect_on_all_associations(:belongs_to).detect { |association|
30 association.name.to_s == associated.to_s
31 }
32 end
33
34 def assert_has_many(model, associated)
35 assert model.reflect_on_all_associations(:has_many).detect { |association|
36 association.name.to_s == associated.to_s
37 }
38 end
39end
40
41module ActiveRecord
42 module ConnectionAdapters
43 class AbstractAdapter
44 def index_exists?(table_name, column_name)
45 indexes(table_name).any? { |index| index.name == index_name(table_name, column_name) }
46 end
47 end
48 end
49end
50
51# module ActiveRecord
52# class BaseWithoutTable < Base
53# self.abstract_class = true
54#
55# def create_or_update
56# errors.empty?
57# end
58#
59# class << self
60# def columns()
61# @columns ||= []
62# end
63#
64# def column(name, sql_type = nil, default = nil, null = true)
65# columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
66# reset_column_information
67# end
68#
69# # Do not reset @columns
70# def reset_column_information
71# read_methods.each { |name| undef_method(name) }
72# @column_names = @columns_hash = @content_columns = @dynamic_methods_hash = @read_methods = nil
73# end
74# end
75# end
76# end \ No newline at end of file