discourse/spec/jobs/update_gravatar_spec.rb
Luciano Sousa b3d769ff4f Update rspec syntax to v3
update rspec syntax to v3

change syntax to rspec v3

oops. fix typo

mailers classes with rspec3 syntax

helpers with rspec3 syntax

jobs with rspec3 syntax

serializers with rspec3 syntax

views with rspec3 syntax

support to rspec3 syntax

category spec with rspec3 syntax
2015-01-05 11:59:30 -03:00

21 lines
781 B
Ruby

require 'spec_helper'
describe Jobs::UpdateGravatar do
it "picks gravatar if system avatar is picked and gravatar was just downloaded" do
user = User.create!(username: "bob", name: "bob", email: "a@a.com")
expect(user.uploaded_avatar_id).to eq(nil)
expect(user.user_avatar.gravatar_upload_id).to eq(nil)
png = Base64.decode64("R0lGODlhAQABALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//wBiZCH5BAEAAA8ALAAAAAABAAEAAAQC8EUAOw==")
FakeWeb.register_uri(:get, "http://www.gravatar.com/avatar/d10ca8d11301c2f4993ac2279ce4b930.png?s=500&d=404", body: png)
SiteSetting.automatically_download_gravatars = true
user.refresh_avatar
user.reload
expect(user.uploaded_avatar_id).to eq(user.user_avatar.gravatar_upload_id)
end
end