aboutsummaryrefslogtreecommitdiffstats
path: root/spec/services
diff options
context:
space:
mode:
authorRobert2017-12-14 16:47:31 +0100
committerRobert2017-12-14 18:00:47 +0100
commit0354c84367cede7d738c79e9c0f116b2c0a178b2 (patch)
treed317604cec8f7150b555a06e554225e177a6c33f /spec/services
parent940ebd078f484a3b3f511baed1574945e705ca83 (diff)
downloadchouette-core-0354c84367cede7d738c79e9c0f116b2c0a178b2.tar.bz2
Refs: #5281@2h; Code Analysis first bugfix
- Rebased #5006 upoon master and created #5281 from #5006 - Setup regression test based on client provided input - Fixed bug with multiple spurious directory occurances
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/zip_service_spec.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/spec/services/zip_service_spec.rb b/spec/services/zip_service_spec.rb
index 751e6c3f1..1eadaa3bf 100644
--- a/spec/services/zip_service_spec.rb
+++ b/spec/services/zip_service_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe ZipService, type: :zip do
end
end
- context 'one messed up' do
+ context 'one messed up' do
let( :zip_name ){ 'one_messed_up.zip' }
let( :zip_content ){ messed_up_referential_data }
@@ -76,11 +76,30 @@ RSpec.describe ZipService, type: :zip do
expected_foreign_lines: %w{C00110 C00111},
expected_spurious: %w{SPURIOUS1 SPURIOUS2}
end
-
+
+ end
+
+ # Regression treated in #5281
+ context 'one_first_level_dir' do
+ let( :zip_data ){ File.read fixtures_path('regression-5281.zip') }
+ let( :zip_name ){ 'regression_5281' }
+
+ let( :allowed_lines ){
+ Set.new([*164..168, 171].map{|line| "C00#{line}"})
+ }
+
+ let( :subdirs ){ subject.to_a }
+
+ it 'returns one not ok object' do
+ expect( subdirs.size ).to eq(1)
+ expect( subdirs.first ).not_to be_ok
+ expect( subdirs.first.spurious ).to eq(%w{OFFRE_SNTYO_1_20170820120001 OFFRE_SNTYO_2_20170820120001})
+ end
end
+
# Behaviour
# ---------
- def expect_correct_subdir subdir, expected_zip
+ def expect_correct_subdir subdir, expected_zip
expect( subdir ).to be_ok
expect( subdir.foreign_lines ).to be_empty
expect( subdir.spurious ).to be_empty
@@ -145,5 +164,4 @@ RSpec.describe ZipService, type: :zip do
}
end
-
end