diff --git a/spec/uploaders/namespace_file_uploader_spec.rb b/spec/uploaders/namespace_file_uploader_spec.rb index d09725ee4be4c64f793f8817f5a7524ba4593ea8..77401814194a68e3731e609489bf273f08db66aa 100644 --- a/spec/uploaders/namespace_file_uploader_spec.rb +++ b/spec/uploaders/namespace_file_uploader_spec.rb @@ -1,18 +1,22 @@ require 'spec_helper' -IDENTIFIER = %r{\h+/\S+} - describe NamespaceFileUploader do let(:group) { build_stubbed(:group) } let(:uploader) { described_class.new(group) } let(:upload) { create(:upload, :namespace_upload, model: group) } + let(:identifier) { %r{\h+/\S+} } subject { uploader } - it_behaves_like 'builds correct paths', - store_dir: %r[uploads/-/system/namespace/\d+], - upload_path: IDENTIFIER, - absolute_path: %r[#{CarrierWave.root}/uploads/-/system/namespace/\d+/#{IDENTIFIER}] + it_behaves_like 'builds correct paths' do + let(:patterns) do + { + store_dir: %r[uploads/-/system/namespace/\d+], + upload_path: identifier, + absolute_path: %r[#{CarrierWave.root}/uploads/-/system/namespace/\d+/#{identifier}] + } + end + end context "object_store is REMOTE" do before do @@ -21,9 +25,14 @@ describe NamespaceFileUploader do include_context 'with storage', described_class::Store::REMOTE - it_behaves_like 'builds correct paths', - store_dir: %r[namespace/\d+/\h+], - upload_path: IDENTIFIER + it_behaves_like 'builds correct paths' do + let(:patterns) do + { + store_dir: %r[namespace/\d+/\h+], + upload_path: identifier + } + end + end end context '.base_dir' do diff --git a/spec/uploaders/personal_file_uploader_spec.rb b/spec/uploaders/personal_file_uploader_spec.rb index 7700b14ce6b9c579195d2ee9e87101eada452f48..2896e9a112defdf7a112e9191c09ba87e4646466 100644 --- a/spec/uploaders/personal_file_uploader_spec.rb +++ b/spec/uploaders/personal_file_uploader_spec.rb @@ -1,18 +1,22 @@ require 'spec_helper' -IDENTIFIER = %r{\h+/\S+} - describe PersonalFileUploader do let(:model) { create(:personal_snippet) } let(:uploader) { described_class.new(model) } let(:upload) { create(:upload, :personal_snippet_upload) } + let(:identifier) { %r{\h+/\S+} } subject { uploader } - it_behaves_like 'builds correct paths', - store_dir: %r[uploads/-/system/personal_snippet/\d+], - upload_path: IDENTIFIER, - absolute_path: %r[#{CarrierWave.root}/uploads/-/system/personal_snippet/\d+/#{IDENTIFIER}] + it_behaves_like 'builds correct paths' do + let(:patterns) do + { + store_dir: %r[uploads/-/system/personal_snippet/\d+], + upload_path: identifier, + absolute_path: %r[#{CarrierWave.root}/uploads/-/system/personal_snippet/\d+/#{identifier}] + } + end + end context "object_store is REMOTE" do before do @@ -21,9 +25,14 @@ describe PersonalFileUploader do include_context 'with storage', described_class::Store::REMOTE - it_behaves_like 'builds correct paths', - store_dir: %r[\d+/\h+], - upload_path: IDENTIFIER + it_behaves_like 'builds correct paths' do + let(:patterns) do + { + store_dir: %r[\d+/\h+], + upload_path: identifier + } + end + end end describe '#to_h' do