aboutsummaryrefslogtreecommitdiffstats
path: root/spec/tasks/reflex_rake_spec.rb
blob: 63d27fca5adca59961a228346db3cd057637d0f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'spec_helper'

describe 'test' do
  before(:all) do
    ['getOP', 'getOR'].each do |method|
      stub_request(:get, "https://reflex.stif.info/ws/reflex/V1/service=getData/?format=xml&idRefa=0&method=#{method}").
      to_return(body: File.open("#{fixture_path}/reflex.zip"), status: 200)
    end
  end

  context 'process stop area sync' do
    it 'should return results on valid request' do
      start = Time.now
      # Must have a referential
      create(:stop_area_referential, name: 'Reflex')

      Stif::ReflexSynchronization.synchronize_stop_area
      Rails.logger.debug "Reflex-api sync done in #{Time.now - start} seconds !"
    end
  end
end