default:
...
development:
...
test:
....
mystore:
adapter: oracle_enhanced
host: <%= ENV['mystore_db_host']%>
port: <%= ENV['mystore_db_port']%>
database: <%= ENV['mystore_db_name']%>
username: <%= ENV['mystore_db_user']%>
password: <%= ENV['mystore_db_password']%>
module MystoreMigration
class MystoreModel < ApplicationRecord
establish_connection(:mystore) unless Rails.env.test?
end
end
module MystoreMigration
class StoreInfo < MystoreModel
...
end
end
development:
mystore_db_host: "XXXX"
mystore_db_port: "XXXX"
mystore_db_name: "XXXX"
mystore_db_user: "XXXX"
mystore_db_password: "XXXX"
....
test:
mystore_db_host: "XXXX"
mystore_db_port: "XXXX"
mystore_db_name: "XXXX"
mystore_db_user: "XXXX"
mystore_db_password: "XXXX"
RSpec.describe MystoreMigration::StoreMigrator do
let(:shop) { build(:shop) }
let(:store) { double(MystoreMigration::StoreInfo)}
let(:store_migrator) { MystoreMigration::StoreMigrator.new([store]) }
describe 'initialization' do
it 'should have stores initialized' do
expect(store_migrator.stores).not_to be_empty
end
end
module MystoreMigration
class StoreMigrator
def initialize(stores = [])
@stores = stores
end
...
OCIError:
ORA-12162: TNS:net service name is incorrectly specified
# oci8.c:561:in oci8lib_250.bundle
# /Users/Serguei/.rvm/gems/ruby-2.5.0/gems/ruby-oci8-2.2.5.1/lib/oci8/oci8.rb:142:in `initialize'