Ensuring that the geo spatial adapters are successfully wired up and working with base import functionality.
[#47]
This commit is contained in:
parent
eec20355e5
commit
6697e2b4db
14 changed files with 65 additions and 22 deletions
1
test/adapters/mysql2spatial.rb
Normal file
1
test/adapters/mysql2spatial.rb
Normal file
|
@ -0,0 +1 @@
|
|||
ENV["ARE_DB"] = "mysql2spatial"
|
1
test/adapters/mysqlspatial.rb
Normal file
1
test/adapters/mysqlspatial.rb
Normal file
|
@ -0,0 +1 @@
|
|||
ENV["ARE_DB"] = "mysqlspatial"
|
1
test/adapters/postgis.rb
Normal file
1
test/adapters/postgis.rb
Normal file
|
@ -0,0 +1 @@
|
|||
ENV["ARE_DB"] = "postgis"
|
1
test/adapters/spatialite.rb
Normal file
1
test/adapters/spatialite.rb
Normal file
|
@ -0,0 +1 @@
|
|||
ENV["ARE_DB"] = "spatialite"
|
|
@ -13,6 +13,12 @@ mysql2:
|
|||
<<: *common
|
||||
adapter: mysql2
|
||||
|
||||
mysqlspatial:
|
||||
<<: *mysql
|
||||
|
||||
mysqlspatial2:
|
||||
<<: *mysql2
|
||||
|
||||
seamless_database_pool:
|
||||
<<: *common
|
||||
adapter: seamless_database_pool
|
||||
|
@ -26,6 +32,9 @@ postgresql:
|
|||
adapter: postgresql
|
||||
min_messages: warning
|
||||
|
||||
postgis:
|
||||
<<: *postgresql
|
||||
|
||||
oracle:
|
||||
<<: *common
|
||||
adapter: oracle
|
||||
|
@ -38,3 +47,6 @@ sqlite:
|
|||
sqlite3:
|
||||
adapter: sqlite3
|
||||
database: test.db
|
||||
|
||||
spatialite:
|
||||
<<: *sqlite3
|
||||
|
|
6
test/mysqlspatial/import_test.rb
Normal file
6
test/mysqlspatial/import_test.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../support/mysql/assertions')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../support/mysql/import_examples')
|
||||
|
||||
should_support_mysql_import_functionality
|
6
test/mysqlspatial2/import_test.rb
Normal file
6
test/mysqlspatial2/import_test.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../support/mysql/assertions')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../support/mysql/import_examples')
|
||||
|
||||
should_support_mysql_import_functionality
|
4
test/postgis/import_test.rb
Normal file
4
test/postgis/import_test.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../support/postgresql/import_examples')
|
||||
|
||||
should_support_postgresql_import_functionality
|
|
@ -1,20 +1,4 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../support/postgresql/import_examples')
|
||||
|
||||
describe "#supports_imports?" do
|
||||
it "should support import" do
|
||||
assert ActiveRecord::Base.supports_import?
|
||||
end
|
||||
end
|
||||
|
||||
describe "#import" do
|
||||
it "should import with a single insert" do
|
||||
# see ActiveRecord::ConnectionAdapters::AbstractAdapter test for more specifics
|
||||
assert_difference "Topic.count", +10 do
|
||||
result = Topic.import Build(3, :topics)
|
||||
assert_equal 1, result.num_inserts
|
||||
|
||||
result = Topic.import Build(7, :topics)
|
||||
assert_equal 1, result.num_inserts
|
||||
end
|
||||
end
|
||||
end
|
||||
should_support_postgresql_import_functionality
|
21
test/support/postgresql/import_examples.rb
Normal file
21
test/support/postgresql/import_examples.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
# encoding: UTF-8
|
||||
def should_support_postgresql_import_functionality
|
||||
describe "#supports_imports?" do
|
||||
it "should support import" do
|
||||
assert ActiveRecord::Base.supports_import?
|
||||
end
|
||||
end
|
||||
|
||||
describe "#import" do
|
||||
it "should import with a single insert" do
|
||||
# see ActiveRecord::ConnectionAdapters::AbstractAdapter test for more specifics
|
||||
assert_difference "Topic.count", +10 do
|
||||
result = Topic.import Build(3, :topics)
|
||||
assert_equal 1, result.num_inserts
|
||||
|
||||
result = Topic.import Build(7, :topics)
|
||||
assert_equal 1, result.num_inserts
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue