diff options
| author | Robert | 2017-11-27 11:27:16 +0100 | 
|---|---|---|
| committer | Robert | 2017-12-14 15:34:46 +0100 | 
| commit | d157011c12b20cedbe4501c4d228ebcdac3647bc (patch) | |
| tree | ad537f208f87a725d4c8800f59f1a6ee1908ce52 /spec/requests | |
| parent | 424496bc6e7b6f94b0f34d3c11fb95fd7f6088c5 (diff) | |
| download | chouette-core-d157011c12b20cedbe4501c4d228ebcdac3647bc.tar.bz2 | |
Fixes: #5006@10h;
   Implementation of Filtering Out Referentials with foreign lines in `app/workers/workbench_import_worker.rb`
   - Using ZipService with the set of allowed lines of the organisation
   - Fixing Integration Specs of the worker
   - Refactoring, Debugging and Rebasing
Diffstat (limited to 'spec/requests')
| -rw-r--r-- | spec/requests/api/v1/netex_import_spec.rb | 47 | 
1 files changed, 22 insertions, 25 deletions
| diff --git a/spec/requests/api/v1/netex_import_spec.rb b/spec/requests/api/v1/netex_import_spec.rb index a90e51e5b..8597c1d32 100644 --- a/spec/requests/api/v1/netex_import_spec.rb +++ b/spec/requests/api/v1/netex_import_spec.rb @@ -32,18 +32,18 @@ RSpec.describe "NetexImport", type: :request do        let( :authorization ){ authorization_token_header( get_api_key.token ) }        #TODO Check why referential_id is nil        it 'succeeds' do -        skip "Problem with referential_id" do -          create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) -          create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) - -          post_request.(netex_import: legal_attributes) -          expect( response ).to be_success -          expect( json_response_body ).to eq( -            'id'             => NetexImport.last.id, -            'referential_id' => Referential.last.id, -            'workbench_id'   => workbench.id -          ) -        end +        # skip "Problem with referential_id" do +        create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) +        create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + +        post_request.(netex_import: legal_attributes) +        expect( response ).to be_success +        expect( json_response_body ).to eq( +          'id'             => NetexImport.last.id, +          'referential_id' => Referential.last.id, +          'workbench_id'   => workbench.id +        ) +        # end        end @@ -54,24 +54,21 @@ RSpec.describe "NetexImport", type: :request do          expect{ post_request.(netex_import: legal_attributes) }.to change{NetexImport.count}.by(1)        end -      #TODO Check why Referential count does not change -      it 'creates a correct Referential' do -        skip "Referential count does not change" do -          create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) -          create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) - -          legal_attributes # force object creation for correct to change behavior -          expect{post_request.(netex_import: legal_attributes)}.to change{Referential.count}.by(1) -          Referential.last.tap do | ref | -            expect( ref.workbench_id ).to eq(workbench.id) -            expect( ref.organisation_id ).to eq(workbench.organisation_id) -          end +      it 'creates a correct Referential', pending: 'see #5073' do +        create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) +        create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + +        legal_attributes # force object creation for correct to change behavior +        expect{post_request.(netex_import: legal_attributes)}.to change{Referential.count}.by(1) +        Referential.last.tap do | ref | +          expect( ref.workbench_id ).to eq(workbench.id) +          expect( ref.organisation_id ).to eq(workbench.organisation_id)          end        end      end -    context 'with incorrect credentials and correct request', pending: "see #4311" do +    context 'with incorrect credentials and correct request', pending: "see #4311 & #5072" do        let( :authorization ){ authorization_token_header( "#{referential.id}-incorrect_token") }        it 'does not create any DB object and does not succeed' do | 
