DEV: Correct specs which had exceptions raised in jobs

This commit is contained in:
David Taylor 2019-04-08 15:58:21 +01:00
parent 20cda5d689
commit 3987691b5e
3 changed files with 13 additions and 8 deletions

View File

@ -529,7 +529,7 @@ describe DiscourseSingleSignOn do
sso.avatar_url = "http://awesome.com/image.png"
sso.suppress_welcome_message = true
FileHelper.stubs(:download).returns(file_from_fixtures("logo.png"))
FileHelper.stubs(:download).returns(file_from_fixtures("logo.png"), file_from_fixtures("logo.png"))
user = sso.lookup_or_create_user(ip_address)
user.reload
avatar_id = user.uploaded_avatar_id
@ -540,8 +540,7 @@ describe DiscourseSingleSignOn do
# junk avatar id should be updated
old_id = user.uploaded_avatar_id
Upload.destroy(old_id)
FileHelper.stubs(:download).returns(file_from_fixtures("logo.png"))
FileHelper.stubs(:download).returns(file_from_fixtures("logo.png"), file_from_fixtures("logo.png"))
user = sso.lookup_or_create_user(ip_address)
user.reload
avatar_id = user.uploaded_avatar_id

View File

@ -140,7 +140,11 @@ describe EmbedController do
end
it "provides the topic retriever with the discourse username when provided" do
TopicRetriever.expects(:new).with(embed_url, has_entry(author_username: discourse_username))
retriever = mock
retriever.expects(:retrieve).returns(nil)
TopicRetriever.expects(:new)
.with(embed_url, has_entry(author_username: discourse_username))
.returns(retriever)
get '/embed/comments',
params: { embed_url: embed_url, discourse_username: discourse_username },

View File

@ -615,10 +615,12 @@ describe PostAlerter do
body = nil
headers = nil
Excon.expects(:post).with { |_req, _body|
headers = _body[:headers]
body = _body[:body]
}.times(3).returns("OK")
stub_request(:post, "https://site2.com/push")
.to_return do |request|
body = request.body
headers = request.headers
{ status: 200, body: "OK" }
end
payload = {
"secret_key" => SiteSetting.push_api_secret_key,