Refactored the paths spec

This commit is contained in:
Thiago Fernandes Massa 2016-04-14 21:22:37 +02:00
parent 810395aa60
commit adffd65d14
1 changed files with 9 additions and 16 deletions

View File

@ -1,25 +1,18 @@
require 'spec_helper'
describe CarrierWave::Uploader do
let(:uploader_class) { Class.new(CarrierWave::Uploader::Base) }
let(:uploader) { uploader_class.new }
before do
@root = CarrierWave.root
CarrierWave.root = nil
@uploader_class = Class.new(CarrierWave::Uploader::Base)
@uploader = @uploader_class.new
end
after do
FileUtils.rm_rf(public_path)
CarrierWave.root = @root
end
after { FileUtils.rm_rf(public_path) }
describe '#root' do
it "should default to the current value of CarrierWave.root" do
expect(@uploader.root).to be_nil
CarrierWave.root = public_path
expect(@uploader.root).to eq(public_path)
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