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-02-27 13:49:34 +00:00
|
|
|
|
|
|
|
module ActiveSupport
|
|
|
|
class TestCase
|
|
|
|
RSpec::Mocks::setup(self)
|
|
|
|
include RSpec::Mocks::ExampleMethods
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Context
|
2012-07-25 16:23:41 +00:00
|
|
|
attr_writer :virtual_path
|
2012-09-11 23:33:04 +00:00
|
|
|
|
2012-02-27 13:49:34 +00:00
|
|
|
def initialize
|
|
|
|
@_assigns = {}
|
2012-07-25 16:23:41 +00:00
|
|
|
@virtual_path = nil
|
|
|
|
end
|
2012-09-11 23:33:04 +00:00
|
|
|
|
2012-07-25 16:23:41 +00:00
|
|
|
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
|
|
|
|
2012-09-11 23:33:04 +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
|