aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorAlban Peignier2017-12-29 10:51:00 +0100
committerAlban Peignier2017-12-29 11:16:58 +0100
commita072b918f274fe902226ae4cc376b318e3881c5f (patch)
treeaf8b7fdeaa8ecc7c3a020e609e5235fedee140f6 /spec
parent84874b0c001239211e18ff7eef2aff7e54721a0d (diff)
downloadchouette-core-a072b918f274fe902226ae4cc376b318e3881c5f.tar.bz2
Validates import file extension with CarrierWave extension_whitelist. Refs #4762
Diffstat (limited to 'spec')
-rw-r--r--spec/models/import_spec.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 3e4128865..ffb2360c2 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -10,8 +10,9 @@ RSpec.describe Import, type: :model do
it { should validate_presence_of(:workbench) }
it { should validate_presence_of(:creator) }
- it { should allow_value('file.zip').for(:file).with_message(I18n.t('activerecord.errors.models.import.attributes.file.wrong_file_extension')) }
- it { should_not allow_values('file.json', 'file.png', 'file.pdf').for(:file) }
+ include ActionDispatch::TestProcess
+ it { should allow_value(fixture_file_upload('OFFRE_TRANSDEV_2017030112251.zip')).for(:file) }
+ it { should_not allow_value(fixture_file_upload('users.json')).for(:file).with_message(I18n.t('errors.messages.extension_whitelist_error', extension: '"json"', allowed_types: "zip")) }
let(:workbench_import) {netex_import.parent}
let(:workbench_import_with_completed_steps) do