Sha256: 0e6d82fade33d9d5eb8ad24fd748e6e3f57e804a428c9543e9dcaac845eda7a9

Contents?: true

Size: 1.77 KB

Versions: 3

Compression:

Stored size: 1.77 KB

Contents

if ENV['COVERAGE'] == 'true'
  require 'simplecov'
  require 'simplecov_json_formatter'
  SimpleCov.formatters = [
    SimpleCov::Formatter::HTMLFormatter,
    SimpleCov::Formatter::JSONFormatter
  ]
end

ENV['RAILS_ENV'] = 'test'
require 'mock_app/config/environment'
require 'rails/test_help'
require 'minitest/autorun'
require 'mocha/minitest'
require 'cow_proxy'

require 'minitest/reporters'
Minitest::Reporters.use! unless ENV['RM_INFO']

def load_schema
  stdout = $stdout
  $stdout = StringIO.new # suppress output while building the schema
  load Rails.root.join('db', 'schema.rb')
  $stdout = stdout
end
load_schema

ActiveScaffold.threadsafe!
# avoid freezing defaults so we can stubs in tests for testing with different defaults
class << ActiveScaffold::Config::Core
  def freeze; end
end

%w[model_stub const_mocker company].each do |file|
  require File.join(File.dirname(__FILE__), file)
end

I18n.backend.store_translations :en, YAML.load_file(File.expand_path('../config/locales/en.yml', __dir__))['en']

# rails 4.0
unless defined? Minitest::Test
  class Minitest::Test < Minitest::Unit::TestCase
  end

  class Minitest::Unit::TestCase
    def with_js_framework(framework)
      framework, ActiveScaffold.js_framework = ActiveScaffold.js_framework, framework
      yield
      ActiveScaffold.js_framework = framework
    end
  end
end

class Minitest::Test
  protected

  def with_js_framework(framework)
    framework, ActiveScaffold.js_framework = ActiveScaffold.js_framework, framework
    yield
    ActiveScaffold.js_framework = framework
  end

  def config_for(klass, namespace = nil)
    ActiveScaffold::Config::Core.new("#{namespace}#{klass.to_s.underscore.downcase}")
  end
end

Config = RbConfig # HACK: needed some comments

class ColumnMock < ActiveScaffold::Tableless::Column
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_scaffold-3.7.11 test/test_helper.rb
active_scaffold-3.7.10 test/test_helper.rb
active_scaffold-3.7.8 test/test_helper.rb