mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
removed imgur support
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
require 'spec_helper'
|
||||
require 'imgur'
|
||||
|
||||
describe Imgur do
|
||||
|
||||
describe "store_file" do
|
||||
|
||||
let(:file) { Rails.root.join('app', 'assets', 'images', 'logo.png') }
|
||||
let(:image_info) { FastImage.new(file) }
|
||||
let(:params) { [SiteSetting.imgur_endpoint, { image: Base64.encode64(file.read) }, { 'Authorization' => "Client-ID #{SiteSetting.imgur_client_id}" }] }
|
||||
|
||||
before(:each) do
|
||||
SiteSetting.stubs(:imgur_endpoint).returns("imgur_endpoint")
|
||||
SiteSetting.stubs(:imgur_client_id).returns("imgur_client_id")
|
||||
end
|
||||
|
||||
it 'returns the url of the Imgur upload if successful' do
|
||||
json = {
|
||||
data: {
|
||||
id: 'fake',
|
||||
link: 'http://imgur.com/fake.png',
|
||||
deletehash: 'a3kaoad30'
|
||||
},
|
||||
success: true,
|
||||
status: 200
|
||||
}.to_json
|
||||
|
||||
response = mock
|
||||
response.expects(:body).returns(json)
|
||||
RestClient.expects(:post).with(*params).returns(response)
|
||||
|
||||
Imgur.store_file(file, image_info, 1).should == 'http://imgur.com/fake.png'
|
||||
end
|
||||
|
||||
it 'returns nil if the request fails' do
|
||||
json = {
|
||||
success: false,
|
||||
status: 400
|
||||
}.to_json
|
||||
|
||||
response = mock
|
||||
response.expects(:body).returns(json)
|
||||
RestClient.expects(:post).with(*params).returns(response)
|
||||
|
||||
Imgur.store_file(file, image_info, 1).should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -37,16 +37,6 @@ describe Upload do
|
||||
end
|
||||
end
|
||||
|
||||
context "imgur" do
|
||||
before(:each) do
|
||||
SiteSetting.stubs(:enable_imgur?).returns(true)
|
||||
Imgur.stubs(:store_file).returns(url)
|
||||
end
|
||||
|
||||
it_behaves_like "upload"
|
||||
|
||||
end
|
||||
|
||||
context "s3" do
|
||||
before(:each) do
|
||||
SiteSetting.stubs(:enable_s3_uploads?).returns(true)
|
||||
|
||||
Reference in New Issue
Block a user