2014-05-22 03:37:02 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe UserAvatar do
|
|
|
|
let(:avatar){
|
|
|
|
user = Fabricate(:user)
|
|
|
|
user.create_user_avatar!
|
|
|
|
}
|
|
|
|
|
|
|
|
it 'can update gravatars' do
|
|
|
|
temp = Tempfile.new('test')
|
2014-05-26 07:17:20 -04:00
|
|
|
temp.binmode
|
|
|
|
# tiny valid png
|
|
|
|
temp.write(Base64.decode64("R0lGODlhAQABALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//wBiZCH5BAEAAA8ALAAAAAABAAEAAAQC8EUAOw=="))
|
|
|
|
temp.rewind
|
2014-05-22 03:37:02 -04:00
|
|
|
FileHelper.expects(:download).returns(temp)
|
|
|
|
avatar.update_gravatar!
|
|
|
|
temp.unlink
|
2014-09-25 11:44:48 -04:00
|
|
|
avatar.gravatar_upload.should_not == nil
|
2014-05-22 03:37:02 -04:00
|
|
|
end
|
|
|
|
end
|