diff options
| author | Luc Donnet | 2018-03-12 15:09:55 +0100 |
|---|---|---|
| committer | GitHub | 2018-03-12 15:09:55 +0100 |
| commit | 10765f6378777d74b121faf9e6f2a17a9fb1594e (patch) | |
| tree | c6ddba1633e7243d5dab189fd3e199e731d21cc2 /spec | |
| parent | 43a5e136c1b35483675918120405cd4f5bea3397 (diff) | |
| parent | b7079226c965e7130a2bcc17b7f278a1e23ac7e8 (diff) | |
| download | chouette-core-10765f6378777d74b121faf9e6f2a17a9fb1594e.tar.bz2 | |
Merge pull request #361 from af83/6068-simple-exporter
6068 simple exporter
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/simple_interfaces_group_spec.rb | 31 |
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..0b6d360de --- /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.all + config.key = "name" + config.add_column :name + end + + SimpleExporter.define :test_2 do |config| + config.collection = Chouette::StopArea.all + 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).and_call_original + expect(test_2).to receive(:export).and_call_original + + group = SimpleInterfacesGroup.new "group" + group.add_interface test_1, "Test 1", :export + group.add_interface test_2, "Test 2", :export + group.run + end + end +end |
