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 65 66 67 68 69 70 71 72 73 74 75
|
ENV['RAILS_ENV'] = 'test'
$:.unshift File.expand_path('../../lib', __FILE__)
# require 'rspec/mocks'
require 'minitest/mock'
require 'minitest/autorun'
require 'rabl-rails'
require 'plist'
if RUBY_ENGINE == 'jruby'
require 'nokogiri'
elsif RUBY_ENGINE == 'ruby'
require 'libxml'
end
MINITEST_TEST_CLASS = if defined?(Minitest::Test)
Minitest::Test
else
Minitest::Unit::TestCase
end
module Configurable
def with_configuration(key, value)
accessor = "#{key}="
old_value = RablRails.configuration.send(key)
RablRails.configuration.send(accessor, value)
yield
ensure
RablRails.configuration.send(accessor, old_value)
end
end
MINITEST_TEST_CLASS.send(:include, Configurable)
module Rails
def self.cache
end
end
module ActionController
module Base
def self.perform_caching
false
end
end
end
class Context
attr_writer :virtual_path
def initialize
@_assigns = {}
@virtual_path = nil
end
def assigns
@_assigns
end
def params
{}
end
def context_method
end
end
class User
attr_accessor :id, :name
def initialize(id = nil, name = nil)
@id = id
@name = name
end
end
|