Sha256: 2ba573ca2126694fbf3892fbc0e9ad27c207f81e74b2fe229d2c502a2f6448fa

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

require "rubygems"

require "simplecov"
SimpleCov.start do
  add_filter "test/"
end

require "minitest/reporters/turn_reporter"
MiniTest::Reporters.use! Minitest::Reporters::TurnReporter.new

require "pry"
require "rr"
require "database_cleaner"
require "abstract_importer"
require "shoulda/context"
require "active_record"
require "support/mock_data_source"
require "support/mock_objects"
require "minitest/autorun"



system "psql -c 'create database abstract_importer_test'"

ActiveRecord::Base.establish_connection(
  adapter: "postgresql",
  host: "localhost",
  database: "abstract_importer_test",
  verbosity: "quiet")

load File.join(File.dirname(__FILE__), "support", "schema.rb")



DatabaseCleaner.strategy = :transaction
$io = ENV['VERBOSE'] ? $stderr : File.open("/dev/null", "w")



class ActiveSupport::TestCase

  setup do
    DatabaseCleaner.start

    @data_source = MockDataSource.new
    @klass = Class.new(AbstractImporter::Base)
    @account = Account.create!
    @options = {}
  end

  teardown do
    DatabaseCleaner.clean
    @importer = nil
  end

protected

  attr_reader :account, :results, :data_source, :options

  def plan(&block)
    @klass.import(&block)
  end

  def depends_on(*args)
    @klass.depends_on(*args)
  end

  def import!
    @results = importer.perform!
  end

  def importer
    @importer ||= @klass.new(@account, @data_source, options.merge(io: $io))
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
abstract_importer-1.6.0 test/test_helper.rb
abstract_importer-1.5.6 test/test_helper.rb
abstract_importer-1.5.5 test/test_helper.rb
abstract_importer-1.5.4 test/test_helper.rb
abstract_importer-1.5.3 test/test_helper.rb
abstract_importer-1.5.2 test/test_helper.rb
abstract_importer-1.5.1 test/test_helper.rb
abstract_importer-1.5.0 test/test_helper.rb
abstract_importer-1.4.1 test/test_helper.rb
abstract_importer-1.4.0 test/test_helper.rb