Revision 2, 1.3 kB
(checked in by falcon, 17 years ago)
|
added plugins
|
Line | |
---|
1 | require 'test/unit' |
---|
2 | require 'rubygems' |
---|
3 | require 'active_support' |
---|
4 | require 'active_record' |
---|
5 | require 'action_view' |
---|
6 | require File.dirname(__FILE__) + '/connection' |
---|
7 | require 'stringio' |
---|
8 | |
---|
9 | RAILS_ROOT = File.dirname(__FILE__) |
---|
10 | RAILS_ENV = "" |
---|
11 | |
---|
12 | $: << "../lib" |
---|
13 | |
---|
14 | require 'file_column' |
---|
15 | require 'file_compat' |
---|
16 | require 'validations' |
---|
17 | require 'test_case' |
---|
18 | |
---|
19 | # do not use the file executable normally in our tests as |
---|
20 | # it may not be present on the machine we are running on |
---|
21 | FileColumn::ClassMethods::DEFAULT_OPTIONS = |
---|
22 | FileColumn::ClassMethods::DEFAULT_OPTIONS.merge({:file_exec => nil}) |
---|
23 | |
---|
24 | class ActiveRecord::Base |
---|
25 | include FileColumn |
---|
26 | include FileColumn::Validations |
---|
27 | end |
---|
28 | |
---|
29 | |
---|
30 | class RequestMock |
---|
31 | attr_accessor :relative_url_root |
---|
32 | |
---|
33 | def initialize |
---|
34 | @relative_url_root = "" |
---|
35 | end |
---|
36 | end |
---|
37 | |
---|
38 | class Test::Unit::TestCase |
---|
39 | |
---|
40 | def assert_equal_paths(expected_path, path) |
---|
41 | assert_equal normalize_path(expected_path), normalize_path(path) |
---|
42 | end |
---|
43 | |
---|
44 | |
---|
45 | private |
---|
46 | |
---|
47 | def normalize_path(path) |
---|
48 | Pathname.new(path).realpath |
---|
49 | end |
---|
50 | |
---|
51 | def clear_validations |
---|
52 | [:validate, :validate_on_create, :validate_on_update].each do |attr| |
---|
53 | Entry.write_inheritable_attribute attr, [] |
---|
54 | Movie.write_inheritable_attribute attr, [] |
---|
55 | end |
---|
56 | end |
---|
57 | |
---|
58 | def file_path(filename) |
---|
59 | File.expand_path("#{File.dirname(__FILE__)}/fixtures/#{filename}") |
---|
60 | end |
---|
61 | |
---|
62 | alias_method :f, :file_path |
---|
63 | end |
---|