diff options
| author | Robert | 2017-11-27 10:25:43 +0100 | 
|---|---|---|
| committer | Robert | 2017-12-14 15:34:46 +0100 | 
| commit | e82600d2efcc90f327b90d04239fe41b80031ad4 (patch) | |
| tree | 1db02ac294eb3a44bc47d81582c60bf98077dd67 /spec/services | |
| parent | 695d6604f12515507e2e8d435370d30df5fc820d (diff) | |
| download | chouette-core-e82600d2efcc90f327b90d04239fe41b80031ad4.tar.bz2 | |
Refs: #5006@3h;
   Zip Support for Specs, allowing to create zip archives in memory
   * create zip archive from hash or directory tree
   * Metaspecs -- commented out
     - for potential refactoring of Zip Support
     - as readable documentation on how to use Zip Support
Diffstat (limited to 'spec/services')
| -rw-r--r-- | spec/services/meta_zip_data_spec.rb | 55 | 
1 files changed, 55 insertions, 0 deletions
| diff --git a/spec/services/meta_zip_data_spec.rb b/spec/services/meta_zip_data_spec.rb new file mode 100644 index 000000000..1cbfee008 --- /dev/null +++ b/spec/services/meta_zip_data_spec.rb @@ -0,0 +1,55 @@ +# Convenience meta spec to debug potential bugs in zip support helpers +# uncomment run and check files in `zip_fixtures_path` +# +# It also describes what the two helpers do and therefore facilitates the usage of  +# +#   * `make_zip` and +#   * `make_zip_from_tree +#  +RSpec.describe 'ZipData', type: [:zip, :meta] do + +  # let( :zip_file ){ zip_fixtures_path('xxx.zip') } +  # let( :tmp_output ){ zip_fixtures_path('tmp') } + +  # before do +  #   clear_all_zip_fixtures! +  #   Dir.mkdir(tmp_output) +  # end + +  # context 'a simple archive' do +  #   let( :zip_data ){ make_zip "xxx.zip", archive_content } +  #   let( :archive_content ){ { +  #         'hello.txt' => 'hello', +  #         'subdir/too.txt' => 'in a subdir' +  #   } } + +  #   it 'handmade: plausibility and manual check' do +  #     zip_data.write_to(zip_file) +  #     %x{unzip -oqq #{zip_file} -d #{tmp_output}} +  #     archive_content.each do | rel_path, content | +  #       expect(File.read(File.join(tmp_output, rel_path))).to eq(content) +  #     end +  #   end +  # end + +  # context 'archive from dir tree' do +  #   let( :dir ){ fixtures_path 'meta_zip' } +  #   let( :zip_data ){ make_zip_from_tree dir } + +  #   let( :archive_content ){ { +  #     'one/alpha'        => "alpha\n", +  #     'two/beta'         => "beta\n", +  #     'two/subdir/gamma' => "gamma\n" +  #   } } + +  #   it 'directory: plausibility and manual check' do +  #     zip_data.write_to(zip_file) +  #     %x{unzip -oqq #{zip_file} -d #{tmp_output}} +  #     archive_content.each do | rel_path, content | +  #       expect(File.read(File.join(tmp_output, rel_path))).to eq(content) +  #     end +  #   end + +  # end +   +end | 
