blob: 0b6d360de4fae06ea6591cf118a6cd9c30e77988 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
 |