Remove stubs from tests.
This commit is contained in:
parent
fb94b4c56d
commit
2a9331d061
|
@ -123,18 +123,22 @@ describe Upload do
|
||||||
end
|
end
|
||||||
|
|
||||||
context ".get_from_url" do
|
context ".get_from_url" do
|
||||||
|
let(:url) { "/uploads/default/original/3X/1/0/10f73034616a796dfd70177dc54b6def44c4ba6f.png" }
|
||||||
|
let!(:upload) { Fabricate(:upload, url: url) }
|
||||||
|
|
||||||
it "works when the file has been uploaded" do
|
it "works when the file has been uploaded" do
|
||||||
Upload.expects(:find_by).returns(nil).once
|
expect(Upload.get_from_url(url)).to eq(upload)
|
||||||
Upload.get_from_url("/uploads/default/1/10387531.jpg")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "works when using a cdn" do
|
it "works when using a cdn" do
|
||||||
Rails.configuration.action_controller.stubs(:asset_host).returns("http://my.cdn.com")
|
begin
|
||||||
Upload.expects(:find_by).with(url: "/uploads/default/1/02395732905.jpg").returns(nil).once
|
original_asset_host = Rails.configuration.action_controller.asset_host
|
||||||
Upload.get_from_url("http://my.cdn.com/uploads/default/1/02395732905.jpg")
|
Rails.configuration.action_controller.asset_host = 'http://my.cdn.com'
|
||||||
|
expect(Upload.get_from_url(URI.join("http://my.cdn.com", url).to_s)).to eq(upload)
|
||||||
|
ensure
|
||||||
|
Rails.configuration.action_controller.asset_host = original_asset_host
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.generate_digest' do
|
describe '.generate_digest' do
|
||||||
|
|
Loading…
Reference in New Issue