require'spec_helper'describePersonalFileUploaderdolet(:uploader){described_class.new(build_stubbed(:empty_project))}let(:snippet){create(:personal_snippet)}describe'.absolute_path'doit'returns the correct absolute path by building it dynamically'doupload=double(model: snippet,path: 'secret/foo.jpg')dynamic_segment="personal_snippet/#{snippet.id}"expect(described_class.absolute_path(upload)).toend_with("#{dynamic_segment}/secret/foo.jpg")endenddescribe'#to_h'doit'returns the hass'douploader=described_class.new(snippet,'secret')allow(uploader).toreceive(:file).and_return(double(extension: 'txt',filename: 'file_name'))expected_url="/uploads/personal_snippet/#{snippet.id}/secret/file_name"expect(uploader.to_h).toeq(alt: 'file_name',url: expected_url,markdown: "[file_name](#{expected_url})")endendend