Sha256: dc0f729573e7e9d672ed79c320cbbcb51afc0bfa15993654c33e6905ec4198fd

Contents?: true

Size: 1.18 KB

Versions: 15

Compression:

Stored size: 1.18 KB

Contents

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

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

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

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

15 entries across 15 versions & 1 rubygems

Version Path
padrino-admin-0.15.1 test/helper.rb
padrino-admin-0.15.0 test/helper.rb
padrino-admin-0.14.4 test/helper.rb
padrino-admin-0.14.3 test/helper.rb
padrino-admin-0.12.9 test/helper.rb
padrino-admin-0.14.2 test/helper.rb
padrino-admin-0.13.3.4 test/helper.rb
padrino-admin-0.14.1.1 test/helper.rb
padrino-admin-0.14.1 test/helper.rb
padrino-admin-0.14.0.2 test/helper.rb
padrino-admin-0.14.0.1 test/helper.rb
padrino-admin-0.14.0 test/helper.rb
padrino-admin-0.14.0.rc2 test/helper.rb
padrino-admin-0.14.0.rc1 test/helper.rb
padrino-admin-0.13.3.3 test/helper.rb