spec/import_spec.rb in cartodb-importer-0.2.8 vs spec/import_spec.rb in cartodb-importer-0.2.9
- old
+ new
@@ -62,11 +62,11 @@
importer = CartoDB::Importer.new :import_from_file => File.expand_path("../support/data/clubbing.csv", __FILE__),
:database => "cartodb_importer_test", :username => 'postgres', :password => '',
:host => 'localhost', :port => 5432, :suggested_name => 'prefered_name'
result = importer.import!
- result.name.should == 'prefered_name_2'
+ result.name.should == 'prefered_name_1'
result.rows_imported.should == 1998
result.import_type.should == '.csv'
end
it "should sanitize column names" do
@@ -180,18 +180,10 @@
:host => 'localhost', :port => 5432, :suggested_name => 'estaciones2'
result = importer.import!
result.name.should == 'estaciones2'
result.rows_imported.should == 30
result.import_type.should == '.csv'
-
- importer2 = CartoDB::Importer.new :import_from_file => File.expand_path("../support/data/estaciones2.csv", __FILE__),
- :database => "cartodb_importer_test", :username => 'postgres', :password => '',
- :host => 'localhost', :port => 5432, :suggested_name => 'estaciones2'
- result2 = importer2.import!
- result2.name.should == 'estaciones2_0'
- result2.rows_imported.should == 30
- result2.import_type.should == '.csv'
end
end
describe "#XLSX" do
it "should import a XLSX file in the given database in a table named like the file" do
@@ -264,16 +256,30 @@
:host => 'localhost', :port => 5432
result = importer.import!
result.name.should == 'tm_world_borders_simpl_0_3'
#result.rows_imported.should == 4365
result.import_type.should == '.shp'
-
- importer = CartoDB::Importer.new :import_from_file => File.expand_path("../support/data/TM_WORLD_BORDERS_SIMPL-0.3.zip", __FILE__),
+ end
+ end
+ describe "Natural Earth Polygons" do
+ it "should import Natural Earth Polygons" do
+ importer = CartoDB::Importer.new :import_from_file => File.expand_path("../support/data/110m-glaciated-areas.zip", __FILE__),
:database => "cartodb_importer_test", :username => 'postgres', :password => '',
:host => 'localhost', :port => 5432
- result2 = importer.import!
- result2.name.should == 'tm_world_borders_simpl_0_3_0'
+ result = importer.import!
#result.rows_imported.should == 4365
- result2.import_type.should == '.shp'
+ result.import_type.should == '.shp'
end
end
+
+ describe "Import from URL" do
+ it "should import a shapefile from NaturalEarthData.com" do
+ importer = CartoDB::Importer.new :import_from_url => "http://www.nacis.org/naturalearth/10m/cultural/10m_parks_and_protected_areas.zip",
+ :database => "cartodb_importer_test", :username => 'postgres', :password => '',
+ :host => 'localhost', :port => 5432
+ result = importer.import!
+ #result.rows_imported.should == 4365
+ result.import_type.should == '.shp'
+ end
+ end
+
end