aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorZog2018-03-06 10:16:07 +0100
committerZog2018-03-06 10:17:44 +0100
commitfacce065c8cf455ab6e1fe44c6d9394b4f2aaa42 (patch)
tree27b9b0a4d8ca8920c69f17e230e87ea14000472f /spec
parentcfdd12aa6b46331435bc62209c51cc14f470bd38 (diff)
downloadchouette-core-facce065c8cf455ab6e1fe44c6d9394b4f2aaa42.tar.bz2
Refs #6068; Add aggregated output for multiple interfaces
Diffstat (limited to 'spec')
-rw-r--r--spec/models/simple_interfaces_group_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/simple_interfaces_group_spec.rb b/spec/models/simple_interfaces_group_spec.rb
new file mode 100644
index 000000000..65ce9a1bf
--- /dev/null
+++ b/spec/models/simple_interfaces_group_spec.rb
@@ -0,0 +1,31 @@
+RSpec.describe SimpleInterfacesGroup do
+ context "with successful interfaces" do
+ before do
+ create :stop_area
+ SimpleExporter.define :test_1 do |config|
+ config.collection = Chouette::StopArea
+ config.key = "name"
+ config.add_column :name
+ end
+
+ SimpleExporter.define :test_2 do |config|
+ config.collection = Chouette::StopArea
+ config.key = "name"
+ config.add_column :lat, attribute: :latitude
+ end
+ end
+
+ it "should run all interfaces" do
+ test_1 = SimpleExporter.new(configuration_name: :test_1, filepath: "tmp/test1.csv")
+ test_2 = SimpleExporter.new(configuration_name: :test_2, filepath: "tmp/test1.csv")
+
+ expect(test_1).to receive(:export)
+ expect(test_2).to receive(:export)
+
+ group = SimpleInterfacesGroup.new "group"
+ group.add_interface test_1, "Test 1", :export
+ group.add_interface test_2, "Test 1", :export
+ group.run
+ end
+ end
+end