diff options
| author | Robert | 2017-08-02 05:54:33 +0200 |
|---|---|---|
| committer | Robert | 2017-08-02 05:59:47 +0200 |
| commit | bfc4aa67c0ff06aaafbade489fa210970aaf2763 (patch) | |
| tree | 0f83fb65d26b615ca4d19e45966fcf420352bcaf /spec | |
| parent | 4ac49da3e416a0ec24a2c0169d5e9fd934c61f01 (diff) | |
| parent | 9387e31a76d9bae4cdb94622081246eea6d6c8d7 (diff) | |
| download | chouette-core-bfc4aa67c0ff06aaafbade489fa210970aaf2763.tar.bz2 | |
conflict resolution
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/requests/api/v1/netex_import_spec.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/spec/requests/api/v1/netex_import_spec.rb b/spec/requests/api/v1/netex_import_spec.rb index a48d5626a..fd5f6d497 100644 --- a/spec/requests/api/v1/netex_import_spec.rb +++ b/spec/requests/api/v1/netex_import_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "NetexImport", type: :request do let( :post_request ) do -> (attributes) do - post "/api/v1/netex_imports.json", + post api_v1_netex_imports_path(format: :json), attributes, authorization end @@ -21,8 +21,7 @@ RSpec.describe "NetexImport", type: :request do { name: 'hello world', file: file, - referential_id: referential.id, - workbench_id: workbench.id + workbench_id: workbench.id } end @@ -69,7 +68,7 @@ RSpec.describe "NetexImport", type: :request do context 'with correct credentials and incorrect request' do let( :authorization ){ authorization_token_header( get_api_key.token ) } - shared_examples_for 'illegal attributes' do |bad_attribute, illegal_value=nil| + shared_examples_for 'illegal attributes' do |bad_attribute, illegal_value=nil, referential_count: 0| context "missing #{bad_attribute}" do let!( :illegal_attributes ){ legal_attributes.merge( bad_attribute => illegal_value ) } it 'does not succeed' do @@ -82,13 +81,13 @@ RSpec.describe "NetexImport", type: :request do expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Import.count} end - it 'does not create a new Referential' do - expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Referential.count} + it 'might create a referential' do + expect{ post_request.(netex_import: illegal_attributes) }.to change{Referential.count}.by(referential_count) end end end - it_behaves_like 'illegal attributes', :file + it_behaves_like 'illegal attributes', :file, referential_count: 1 it_behaves_like 'illegal attributes', :workbench_id context 'name already taken' do before do |
