DEV: Correct specs which had exceptions raised in jobs

DEV: Correct specs which had exceptions raised in jobs

diff --git a/spec/models/discourse_single_sign_on_spec.rb b/spec/models/discourse_single_sign_on_spec.rb
index 4409b57..6b5ac98 100644
--- a/spec/models/discourse_single_sign_on_spec.rb
+++ b/spec/models/discourse_single_sign_on_spec.rb
@@ -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
diff --git a/spec/requests/embed_controller_spec.rb b/spec/requests/embed_controller_spec.rb
index cd4a2df..18fd064 100644
--- a/spec/requests/embed_controller_spec.rb
+++ b/spec/requests/embed_controller_spec.rb
@@ -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 },
diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb
index c81a25b..b137ad4 100644
--- a/spec/services/post_alerter_spec.rb
+++ b/spec/services/post_alerter_spec.rb
@@ -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,

GitHub sha: 3987691b

2 Likes