diff options
| author | Robert | 2017-07-20 11:45:30 +0200 | 
|---|---|---|
| committer | Robert | 2017-07-20 11:45:30 +0200 | 
| commit | 327c27559a955782b70dff46aeca1c58dcf95836 (patch) | |
| tree | d3a975cbfc87846bc1109eb44ed986b1340ccd53 /spec/requests | |
| parent | 2de0d63c148218c983a30117ee277ef9307906c8 (diff) | |
| download | chouette-core-327c27559a955782b70dff46aeca1c58dcf95836.tar.bz2 | |
Fixes: #3506@0.5h
* CR refacts (netex_import req spec)
* Dead Code Elimination (mount in Import subclasses)
Diffstat (limited to 'spec/requests')
| -rw-r--r-- | spec/requests/api/v1/netex_import_spec.rb | 28 | 
1 files changed, 14 insertions, 14 deletions
| diff --git a/spec/requests/api/v1/netex_import_spec.rb b/spec/requests/api/v1/netex_import_spec.rb index de281aa66..9fbf8f801 100644 --- a/spec/requests/api/v1/netex_import_spec.rb +++ b/spec/requests/api/v1/netex_import_spec.rb @@ -15,30 +15,30 @@ RSpec.describe "NetexImport", type: :request do        end      end -    let( :legal_attributes ){ { -      netex_import: { +    let( :legal_attributes ) do +      {          name: 'hello world',          file: file, -        referential_id: referential.id} -    } } +        referential_id: referential.id +      } +    end  -    let( :illegal_attributes ){ { -      netex_import: { -        referential_id: referential.id} -    } } +    let( :illegal_attributes ) do +      { referential_id: referential.id } +    end       context 'with correct credentials and correct request' do        let( :authorization ){ authorization_token_header( get_api_key.token ) }        it 'succeeds' do -        post_request.(legal_attributes) +        post_request.(netex_import: legal_attributes)          expect( response ).to be_success          expect( json_response_body ).to eq({'id' => NetexImport.last.id, 'type' => 'NetexImport'})        end        it 'creates a NetexImport object in the DB' do -        expect{ post_request.(legal_attributes) }.to change{NetexImport.count}.by(1) +        expect{ post_request.(netex_import: legal_attributes) }.to change{NetexImport.count}.by(1)        end      end @@ -46,12 +46,12 @@ RSpec.describe "NetexImport", type: :request do        let( :authorization ){ authorization_token_header( "#{referential.id}-incorrect_token") }        it 'does not succeed' do -        post_request.(legal_attributes) +        post_request.(netex_import: legal_attributes)          expect( response.status ).to eq(401)        end        it 'does not create an Import object' do -        expect{ post_request.(legal_attributes) }.not_to change{Import.count} +        expect{ post_request.(netex_import: legal_attributes) }.not_to change{Import.count}        end      end @@ -59,13 +59,13 @@ RSpec.describe "NetexImport", type: :request do        let( :authorization ){ authorization_token_header( get_api_key.token ) }        it 'does not succeed' do -        post_request.(illegal_attributes) +        post_request.(netex_import: illegal_attributes)          expect( response.status ).to eq(406)          expect( json_response_body['errors']['file'] ).not_to be_empty        end        it 'does not create an Import object' do -        expect{ post_request.(illegal_attributes) }.not_to change{Import.count} +        expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Import.count}        end      end    end | 
