diff options
| author | Robert | 2017-11-15 17:15:24 +0100 |
|---|---|---|
| committer | Robert | 2017-11-17 14:49:19 +0100 |
| commit | 2b925fe2bf8f33a0d10dfe1307b086d9e3f0add4 (patch) | |
| tree | 877a1b225c4387c4f51807d26599592e8f506b22 /spec | |
| parent | 21ddaefb9fc092463261284b0b7b493709201a3b (diff) | |
| download | chouette-core-2b925fe2bf8f33a0d10dfe1307b086d9e3f0add4.tar.bz2 | |
Fixes: #4461@2h; Specing and Implementing
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/import/netex_import_spec.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/models/import/netex_import_spec.rb b/spec/models/import/netex_import_spec.rb index e15fbb977..b23abf776 100644 --- a/spec/models/import/netex_import_spec.rb +++ b/spec/models/import/netex_import_spec.rb @@ -1,23 +1,28 @@ RSpec.describe NetexImport, type: :model do + let( :invoked_calls ){ [] } + + let( :http_service ){ double 'Net::HTTP' } + before do + stub_const 'Net::HTTP', http_service + allow(http_service).to receive( :get ){ invoked_calls << :called } + end context 'with referential' do + subject { build :netex_import } it 'will trigger the Java API' do - + subject.save + expect( invoked_calls ).to eq([:called]) end end context 'without referential' do subject { build :netex_import, referential_id: nil } - it 'is aborted if it does not have a referential' do - require 'pry'; binding.pry - - - end - - it 'will not trigger the Java API' do - + it 'its status is forced to aborted and the Java API is not callled' do + subject.save! + expect( subject.reload.status ).to eq('aborted') + expect( invoked_calls ).to be_empty end end |
