From 65ac74812afc241dddd8f5c244ee9328b8997405 Mon Sep 17 00:00:00 2001 From: Luc Donnet Date: Tue, 9 Jul 2013 13:34:51 +0200 Subject: Link export view with kml export --- spec/exporters/chouette/kml/exporter_spec.rb | 29 +++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'spec/exporters') diff --git a/spec/exporters/chouette/kml/exporter_spec.rb b/spec/exporters/chouette/kml/exporter_spec.rb index 5f2b30b82..f44e8f201 100644 --- a/spec/exporters/chouette/kml/exporter_spec.rb +++ b/spec/exporters/chouette/kml/exporter_spec.rb @@ -2,29 +2,40 @@ require 'spec_helper' describe Chouette::Kml::Exporter do - let(:referential) { Factory(:referential) } - subject { Chouette::Kml::Exporter.new(referential) } + # let(:referential) { Factory(:referential) } + # subject { Chouette::Kml::Exporter.new(referential) } + + # let(:zip_file_path) { "#{Rails.root}/tmp/exports/test.zip" } + # let(:line) { + # referential.switch + # Factory(:line_with_stop_areas_having_parent) } + + subject { Chouette::Kml::Exporter.new(first_referential) } let(:zip_file_path) { "#{Rails.root}/tmp/exports/test.zip" } - let(:line) { - referential.switch - Factory(:line_with_stop_areas_having_parent) } + let!(:line) { Factory(:line_with_stop_areas_having_parent) } + let!(:line2) { Factory(:line_with_stop_areas_having_parent) } describe "#export" do it "should return a zip file with nothing inside with no objects in arguments" do - subject.export(zip_file_path, {} ) + subject.export(zip_file_path, {:export_id => 1, :o => "line"} ) File.exists?(zip_file_path).should be_true - puts ::Zip::ZipFile.open(zip_file_path).entries.inspect - ::Zip::ZipFile.open(zip_file_path).size.should == 0 + ::Zip::ZipFile.open(zip_file_path).size.should == 6 end - it "should return a zip file with the kml of the line inside with a line in arguments" do + it "should return a zip file with 4 kml files" do subject.export(zip_file_path, {:export_id => 1, :o => "line", :id => "#{line.id}" } ) File.exists?(zip_file_path).should be_true ::Zip::ZipFile.open(zip_file_path).size.should == 4 end + it "should return a zip file with 6 kml files" do + subject.export(zip_file_path, {:export_id => 1, :o => "line", :id => "#{line.id},#{line2.id}" } ) + File.exists?(zip_file_path).should be_true + ::Zip::ZipFile.open(zip_file_path).size.should == 6 + end + end -- cgit v1.2.3