Sha256: 13ba617870e03b443e915ca02f081bc8739eb673f6fd0270a6a36d7529f0b983

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

ENV['RACK_ENV'] = 'test'
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT

require 'minitest/autorun'
require 'minitest/pride'
require 'rack/test'
require 'thor/group'
require 'sequel/model'
require 'padrino-admin'

require 'ext/minitest-spec'
require 'ext/rack-test-methods'
require 'mocha/minitest'

Padrino::Generators.load_components!

module Kernel
  def load_fixture(file)
    Object.send(:remove_const, :Account)  if defined?(Account)
    Object.send(:remove_const, :Category) if defined?(Category)
    file += ".rb" if file !~ /.rb$/
    capture_io { load File.join(File.dirname(__FILE__), "fixtures", file) }
  end
end

class Minitest::Spec
  include Rack::Test::Methods

  # Sets up a Sinatra::Base subclass defined with the block
  # given. Used in setup or individual spec methods to establish
  # the application.
  def mock_app(base=Padrino::Application, &block)
    @app = Sinatra.new base do
      register Padrino::Helpers
      instance_eval &block
    end
  end

  def app
    Rack::Lint.new(@app)
  end

  # generate(:admin_app, "-r=#{@apptmp}/sample_project")
  def generate(name, *params)
    "Padrino::Generators::#{name.to_s.camelize}".constantize.start(params)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
padrino-admin-0.16.0.pre3 test/helper.rb
padrino-admin-0.16.0.pre2 test/helper.rb