Sha256: 9548866576e786c4cc9b4fab5a7f0a15d2921d4ecfd977f14b2d76e94dfe7711

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'rubygems'
require 'bundler'

Bundler.setup
require 'test/unit'
require 'mocha'

# Configure Rails
ENV["RAILS_ENV"] = "test"

require 'active_support'
require 'action_controller'
require 'active_model'
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
  match '/admin/:action', :controller => "admin/addresses"
  match '/:controller(/:action(/:id))'
end

ActionController::Base.send :include, Responders::Routes.url_helpers

class ActiveSupport::TestCase
  setup do
    @routes = Responders::Routes
  end
end

class Model
  include ActiveModel::Conversion
  include ActiveModel::Validations

  attr_accessor :persisted, :updated_at
  alias :persisted? :persisted

  def persisted?
    @persisted
  end

  def to_xml(*args)
    "<xml />"
  end

  def initialize(updated_at=nil)
    @persisted = true
    self.updated_at = updated_at
  end
end

class Address < Model
end

class User < Model
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
responders-0.6.2 test/test_helper.rb