aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/export/netex_spec.rb
blob: d9cccd6ad9fcb12a4234e628a0cd90c2c97135dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
RSpec.describe Export::Netex, type: [:model, :with_commit] do

  let( :boiv_iev_uri ){  URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/exporter/new?id=#{subject.id}")}

  before do
    allow(Thread).to receive(:new).and_yield
  end

  context 'with referential' do
    subject{ build( :netex_export, id: random_int ) }

    it 'will trigger the Java API' do
      with_stubbed_request(:get, boiv_iev_uri) do |request|
        with_commit{ subject.save! }
        expect(request).to have_been_requested
      end
    end
  end
end