# File lib/dm-core/spec/setup.rb, line 99 99: def adapter 100: @adapter ||= setup! 101: end
# File lib/dm-core/spec/setup.rb, line 113 113: def adapter_name 114: @adapter_name ||= infer_adapter_name 115: end
# File lib/dm-core/spec/setup.rb, line 129 129: def alternate_storage_name 130: "datamapper_alternate_tests" 131: end
# File lib/dm-core/spec/setup.rb, line 117 117: def connection_uri 118: "#{adapter_name}://#{username}:#{password}@#{host}/#{storage_name}" 119: end
# File lib/dm-core/spec/setup.rb, line 125 125: def default_storage_name 126: "datamapper_default_tests" 127: end
# File lib/dm-core/spec/setup.rb, line 141 141: def host 142: ENV.fetch('DM_DB_HOST', 'localhost') 143: end
# File lib/dm-core/spec/setup.rb, line 137 137: def password 138: ENV.fetch('DM_DB_PASSWORD', 'datamapper') 139: end
# File lib/dm-core/spec/setup.rb, line 105 105: def setup! 106: adapter = DataMapper.setup(name, connection_uri) 107: test_connection(adapter) 108: adapter 109: rescue Exception => e 110: puts "Could not connect to the database using '#{connection_uri}' because of: #{e.inspect}" 111: end
# File lib/dm-core/spec/setup.rb, line 121 121: def storage_name 122: send("#{name}_storage_name") 123: end
Test the connection
Overwrite this method if you need to perform custom connection testing
@raise [Exception]
# File lib/dm-core/spec/setup.rb, line 150 150: def test_connection(adapter) 151: if adapter.respond_to?(:select) 152: adapter.select('SELECT 1') 153: end 154: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.