Commit 20526df9 authored by Semyon Pupkov's avatar Semyon Pupkov

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
parent fa3528ee
require 'spec_helper' require 'spec_helper'
IDENTIFIER = %r{\h+/\S+}
describe NamespaceFileUploader do describe NamespaceFileUploader do
let(:group) { build_stubbed(:group) } let(:group) { build_stubbed(:group) }
let(:uploader) { described_class.new(group) } let(:uploader) { described_class.new(group) }
let(:upload) { create(:upload, :namespace_upload, model: group) } let(:upload) { create(:upload, :namespace_upload, model: group) }
let(:identifier) { %r{\h+/\S+} }
subject { uploader } subject { uploader }
it_behaves_like 'builds correct paths', it_behaves_like 'builds correct paths' do
store_dir: %r[uploads/-/system/namespace/\d+], let(:patterns) do
upload_path: IDENTIFIER, {
absolute_path: %r[#{CarrierWave.root}/uploads/-/system/namespace/\d+/#{IDENTIFIER}] 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 context "object_store is REMOTE" do
before do before do
...@@ -21,9 +25,14 @@ describe NamespaceFileUploader do ...@@ -21,9 +25,14 @@ describe NamespaceFileUploader do
include_context 'with storage', described_class::Store::REMOTE include_context 'with storage', described_class::Store::REMOTE
it_behaves_like 'builds correct paths', it_behaves_like 'builds correct paths' do
store_dir: %r[namespace/\d+/\h+], let(:patterns) do
upload_path: IDENTIFIER {
store_dir: %r[namespace/\d+/\h+],
upload_path: identifier
}
end
end
end end
context '.base_dir' do context '.base_dir' do
......
require 'spec_helper' require 'spec_helper'
IDENTIFIER = %r{\h+/\S+}
describe PersonalFileUploader do describe PersonalFileUploader do
let(:model) { create(:personal_snippet) } let(:model) { create(:personal_snippet) }
let(:uploader) { described_class.new(model) } let(:uploader) { described_class.new(model) }
let(:upload) { create(:upload, :personal_snippet_upload) } let(:upload) { create(:upload, :personal_snippet_upload) }
let(:identifier) { %r{\h+/\S+} }
subject { uploader } subject { uploader }
it_behaves_like 'builds correct paths', it_behaves_like 'builds correct paths' do
store_dir: %r[uploads/-/system/personal_snippet/\d+], let(:patterns) do
upload_path: IDENTIFIER, {
absolute_path: %r[#{CarrierWave.root}/uploads/-/system/personal_snippet/\d+/#{IDENTIFIER}] 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 context "object_store is REMOTE" do
before do before do
...@@ -21,9 +25,14 @@ describe PersonalFileUploader do ...@@ -21,9 +25,14 @@ describe PersonalFileUploader do
include_context 'with storage', described_class::Store::REMOTE include_context 'with storage', described_class::Store::REMOTE
it_behaves_like 'builds correct paths', it_behaves_like 'builds correct paths' do
store_dir: %r[\d+/\h+], let(:patterns) do
upload_path: IDENTIFIER {
store_dir: %r[\d+/\h+],
upload_path: identifier
}
end
end
end end
describe '#to_h' do describe '#to_h' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment