lib/valkyrie/specs/shared_specs/storage_adapter.rb in valkyrie-2.0.0.RC3 vs lib/valkyrie/specs/shared_specs/storage_adapter.rb in valkyrie-2.0.0.RC4
- old
+ new
@@ -3,23 +3,23 @@
before do
raise 'storage_adapter must be set with `let(:storage_adapter)`' unless
defined? storage_adapter
raise 'file must be set with `let(:file)`' unless
defined? file
- class CustomResource < Valkyrie::Resource
+ class Valkyrie::Specs::CustomResource < Valkyrie::Resource
end
end
after do
- Object.send(:remove_const, :CustomResource)
+ Valkyrie::Specs.send(:remove_const, :CustomResource)
end
subject { storage_adapter }
it { is_expected.to respond_to(:handles?).with_keywords(:id) }
it { is_expected.to respond_to(:find_by).with_keywords(:id) }
it { is_expected.to respond_to(:delete).with_keywords(:id) }
it { is_expected.to respond_to(:upload).with_keywords(:file, :resource, :original_filename) }
it "can upload, validate, re-fetch, and delete a file" do
- resource = CustomResource.new(id: "test")
+ resource = Valkyrie::Specs::CustomResource.new(id: "test")
sha1 = Digest::SHA1.file(file).to_s
size = file.size
expect(uploaded_file = storage_adapter.upload(file: file, original_filename: 'foo.jpg', resource: resource)).to be_kind_of Valkyrie::StorageAdapter::File
expect(uploaded_file).to respond_to(:checksum).with_keywords(:digests)