Testing Root Path Configuration Implementation in CarrierWave
This test suite examines the path handling functionality in CarrierWave’s uploader component, specifically focusing on root directory configuration. The tests verify the uploader’s ability to properly manage file storage paths and ensure correct root directory assignment for file uploads.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
carrierwaveuploader/carrierwave
spec/uploader/paths_spec.rb
require 'spec_helper'
describe CarrierWave::Uploader do
let(:uploader_class) { Class.new(CarrierWave::Uploader::Base) }
let(:uploader) { uploader_class.new }
after { FileUtils.rm_rf(public_path) }
describe '#root' do
describe "default behavior" do
before { CarrierWave.root = public_path }
it "defaults to the current value of CarrierWave.root" do
expect(uploader.root).to eq(public_path)
end
end
end
end