test/test_helper.rb in ofac-2.0.4 vs test/test_helper.rb in ofac-3.0.0

- old
+ new

@@ -1,53 +1,22 @@ -require 'test/unit' -require 'turn' -require 'shoulda' -require 'mocks/test/ofac_sdn_loader' +# Configure Rails Environment +ENV['RAILS_ENV'] = 'test' +require File.expand_path('../dummy/config/environment.rb', __FILE__) +require 'rails/test_help' + # for RubyMine require 'minitest/reporters' -MiniTest::Reporters.use! [MiniTest::Reporters::RubyMineReporter.new] if ENV["RUBYMINE_TESTUNIT_REPORTER"] +MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$LOAD_PATH.unshift(File.dirname(__FILE__)) -require 'ofac' - -ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:' - -class Test::Unit::TestCase - def setup_ofac_sdn_table - ActiveRecord::Base.connection.tables.each { |table| ActiveRecord::Base.connection.drop_table(table) } - create_ofac_sdn_table +class ActiveSupport::TestCase + def load_test_sdn_file + sdn = File.new(File.dirname(__FILE__) + '/files/test_sdn_data_load.pip') + address = File.new(File.dirname(__FILE__) + '/files/test_address_data_load.pip') + alt = File.new(File.dirname(__FILE__) + '/files/test_alt_data_load.pip') + OfacSdnIndividualLoader.active_record_file_load(sdn, address, alt) + sdn.close + address.close + alt.close end - - private - - def create_ofac_sdn_table - silence_stream(STDOUT) do - ActiveRecord::Schema.define(:version => 1) do - create_table :ofac_sdns do |t| - t.text :name - t.string :sdn_type - t.string :program - t.string :title - t.string :vessel_call_sign - t.string :vessel_type - t.string :vessel_tonnage - t.string :gross_registered_tonnage - t.string :vessel_flag - t.string :vessel_owner - t.text :remarks - t.text :address - t.string :city - t.string :country - t.string :address_remarks - t.string :alternate_identity_type - t.text :alternate_identity_name - t.string :alternate_identity_remarks - t.timestamps - end - add_index :ofac_sdns, :sdn_type - end - end - end - end +