mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 02:58:48 +08:00
Use webmock to stub external web requests.
This commit is contained in:
@ -74,7 +74,8 @@ describe UploadsController do
|
||||
controller.stubs(:is_api?).returns(true)
|
||||
|
||||
Jobs.expects(:enqueue).with(:create_avatar_thumbnails, anything)
|
||||
Excon.stub({ method: :head, hostname: 'example.com' }, {})
|
||||
|
||||
stub_request(:head, 'http://example.com/image.png')
|
||||
stub_request(:get, "http://example.com/image.png").to_return(body: File.read('spec/fixtures/images/logo.png'))
|
||||
|
||||
xhr :post, :create, url: 'http://example.com/image.png', type: "avatar", synchronous: true
|
||||
|
@ -24,7 +24,6 @@ describe UserAvatarsController do
|
||||
SiteSetting.s3_upload_bucket = "test"
|
||||
SiteSetting.s3_cdn_url = "http://cdn.com"
|
||||
|
||||
Excon.stub({ method: :head, hostname: 'cdn.com' }, {})
|
||||
stub_request(:get, "http://cdn.com/something/else").to_return(body: 'image')
|
||||
|
||||
GlobalSetting.expects(:cdn_url).returns("http://awesome.com/boom")
|
||||
|
Reference in New Issue
Block a user