rabl-rails/test/test_helper.rb

66 lines
1.0 KiB
Ruby
Raw Normal View History

2012-02-22 10:42:38 +00:00
ENV["RAILS_ENV"] = "test"
2012-02-22 18:14:00 +00:00
$:.unshift File.expand_path('../../lib', __FILE__)
2012-02-22 10:42:38 +00:00
2012-02-27 13:49:34 +00:00
require 'rspec/mocks'
2012-02-22 18:14:00 +00:00
require 'minitest/autorun'
require 'active_support/test_case'
2012-03-02 10:32:11 +00:00
2012-04-02 14:22:43 +00:00
require 'action_controller'
2012-03-02 10:32:11 +00:00
require 'singleton'
class <<Singleton
def included_with_reset(klass)
included_without_reset(klass)
class <<klass
def reset_instance
Singleton.send :__init__, self
self
end
end
end
alias_method_chain :included, :reset
end
2012-04-20 14:28:34 +00:00
require 'rabl-rails'
2012-11-14 14:13:59 +00:00
require 'plist'
2012-11-14 14:19:13 +00:00
if RUBY_ENGINE == 'jruby'
2012-11-14 14:13:59 +00:00
require 'nokogiri'
2012-11-14 14:19:13 +00:00
else
require 'libxml'
2012-11-14 14:13:59 +00:00
end
RablRails.load_default_engines!
2012-02-27 13:49:34 +00:00
module ActiveSupport
class TestCase
RSpec::Mocks::setup(self)
include RSpec::Mocks::ExampleMethods
end
end
class Context
attr_writer :virtual_path
2012-02-27 13:49:34 +00:00
def initialize
@_assigns = {}
@virtual_path = nil
end
def assigns
@_assigns
2012-02-27 13:49:34 +00:00
end
2012-04-15 16:17:49 +00:00
def params
{}
2012-02-27 13:49:34 +00:00
end
end
2012-04-15 16:17:49 +00:00
class User
attr_accessor :id, :name, :sex
def initialize(id=nil, name=nil, sex=nil)
@id = id
@name = name
@sex = sex
end
end