root/vendor/plugins/file_column/test/abstract_unit.rb @ 2

Revision 2, 1.3 kB (checked in by falcon, 17 years ago)

added plugins

Line 
1require 'test/unit'
2require 'rubygems'
3require 'active_support'
4require 'active_record'
5require 'action_view'
6require File.dirname(__FILE__) + '/connection'
7require 'stringio'
8
9RAILS_ROOT = File.dirname(__FILE__)
10RAILS_ENV = ""
11
12$: << "../lib"
13
14require 'file_column'
15require 'file_compat'
16require 'validations'
17require '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
21FileColumn::ClassMethods::DEFAULT_OPTIONS = 
22  FileColumn::ClassMethods::DEFAULT_OPTIONS.merge({:file_exec => nil})
23
24class ActiveRecord::Base
25    include FileColumn
26    include FileColumn::Validations
27end
28
29
30class RequestMock
31  attr_accessor :relative_url_root
32
33  def initialize
34    @relative_url_root = ""
35  end
36end
37
38class 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
63end
Note: See TracBrowser for help on using the browser.