diff options
author | Semyon Pupkov <mail@semyonpupkov.com> | 2018-12-09 22:16:09 +0300 |
---|---|---|
committer | Semyon Pupkov <mail@semyonpupkov.com> | 2018-12-10 09:00:08 +0300 |
commit | 20526df9880aca1aff6ac4f0be0173271c8ecfff (patch) | |
tree | 814d38a7145a463ae113fa9105c57d22aadc5fdc /spec | |
parent | fa3528ee5a0cedf10a05035ce5c713c3fea0ec6f (diff) |
Fix already initialized constant IDENTIFIER warning
/app/spec/uploaders/personal_file_uploader_spec.rb:3: warning: already initialized constant IDENTIFIER
/app/spec/uploaders/namespace_file_uploader_spec.rb:3: warning: previous definition of IDENTIFIER was here
Diffstat (limited to 'spec')
-rw-r--r-- | spec/uploaders/namespace_file_uploader_spec.rb | 27 | ||||
-rw-r--r-- | spec/uploaders/personal_file_uploader_spec.rb | 27 |
2 files changed, 36 insertions, 18 deletions
diff --git a/spec/uploaders/namespace_file_uploader_spec.rb b/spec/uploaders/namespace_file_uploader_spec.rb index d09725ee4be..77401814194 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 7700b14ce6b..2896e9a112d 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 |