forked from heartcombo/responders
/
test_helper.rb
64 lines (49 loc) · 1.21 KB
/
test_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require 'rubygems'
gem 'activesupport', '3.0.0.beta2'
gem 'activemodel', '3.0.0.beta2'
gem 'actionpack', '3.0.0.beta2'
gem 'railties', '3.0.0.beta2'
begin
gem "test-unit"
rescue LoadError
end
begin
gem "ruby-debug"
require 'ruby-debug'
rescue LoadError
end
require 'test/unit'
require 'mocha'
# Configure Rails
ENV["RAILS_ENV"] = "test"
require 'active_support'
require 'action_controller'
require 'rails/railtie'
class ApplicationController < ActionController::Base
respond_to :html, :xml
end
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'responders'
I18n.load_path << File.join(File.dirname(__FILE__), 'locales', 'en.yml')
I18n.reload!
ActionController::Base.view_paths = File.join(File.dirname(__FILE__), 'views')
Responders::Routes = ActionDispatch::Routing::RouteSet.new
Responders::Routes.draw do |map|
map.connect 'admin/:action', :controller => "admin/addresses"
map.connect ':controller/:action/:id'
map.connect ':controller/:action'
end
class ActiveSupport::TestCase
setup do
@routes = Responders::Routes
end
end
class Model < Struct.new(:updated_at)
attr_writer :new_record
def new_record?
@new_record || false
end
def to_xml(*args)
"<xml />"
end
end