Commit ecc8326b authored by Micaël Bergeron's avatar Micaël Bergeron

fix the Upload#store not being updated upon migration

parent a50ab5e1
......@@ -37,8 +37,10 @@ module ObjectStorage
super
end
def build_upload_from_uploader(uploader)
super.tap { |upload| upload.store = object_store }
def build_upload
super.tap do |upload|
upload.store = object_store
end
end
def upload=(upload)
......
......@@ -75,52 +75,3 @@ shared_examples "migrates" do |to_store:, from_store: nil|
end
end
end
shared_examples "matches the method pattern" do |method|
let(:target) { subject }
let(:args) { nil }
let(:pattern) { patterns[method] }
it do
return skip "No pattern provided, skipping." unless pattern
expect(target.method(method).call(*args)).to match(pattern)
end
end
shared_examples "builds correct paths" do |**patterns|
let(:patterns) { patterns }
before do
allow(subject).to receive(:filename).and_return('<filename>')
end
describe "#store_dir" do
it_behaves_like "matches the method pattern", :store_dir
end
describe "#cache_dir" do
it_behaves_like "matches the method pattern", :cache_dir
end
describe "#work_dir" do
it_behaves_like "matches the method pattern", :work_dir
end
describe "#upload_path" do
it_behaves_like "matches the method pattern", :upload_path
end
describe ".absolute_path" do
it_behaves_like "matches the method pattern", :absolute_path do
let(:target) { subject.class }
let(:args) { [upload] }
end
end
describe ".base_dir" do
it_behaves_like "matches the method pattern", :base_dir do
let(:target) { subject.class }
end
end
end
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