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
|
|
|
|
|
|
|
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-02-22 18:14:00 +00:00
|
|
|
require 'rabl-fast-json'
|
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_accessor :virtual_path
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
@_assigns = {}
|
|
|
|
@virtual_path = '/users'
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_assign(key, value)
|
|
|
|
@_assigns[key] = value
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_assign(key)
|
|
|
|
@_assigns[key]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-02-27 16:25:06 +00:00
|
|
|
User = Struct.new(:id, :name, :sex)
|